Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using HYPE libraries with java applications? #159

Open
sheldon-white opened this issue Oct 13, 2018 · 1 comment
Open

Using HYPE libraries with java applications? #159

sheldon-white opened this issue Oct 13, 2018 · 1 comment

Comments

@sheldon-white
Copy link

sheldon-white commented Oct 13, 2018

I'm currently writing Processing applications with java (rather than pde files within the processing app).
It doesn't seem like the HYPE libraries work as is-in this environment. Is this a use case that's supported in any way?

Here's an example, adapted from a working pde file:

import hype.*;
import hype.extended.behavior.HRotate;
import processing.core.PApplet;

public class HypeTest1 extends PApplet {

    public static void main(String args[]) {
        PApplet.main("HypeTest1");
    }


    @Override
    public void settings() {
        size(640,640);
    }

    public void setup() {
        H.init(this).background(0x202020);
        smooth();

        HDrawable r = new HRect(20).rounding(2).noStroke().anchorAt(H.CENTER);

        HDrawable d1 = H.add(new HRect(50).rounding(4)).noStroke().fill(0x00616f).anchorAt(H.CENTER).loc(width/5,height/2);
        d1.add(r.createCopy()).fill(0xFF3300).locAt(H.TOP_LEFT);
        d1.add(r.createCopy()).fill(0xFF3300).locAt(H.BOTTOM_RIGHT);

        HDrawable d2 = H.add(new HRect(50).rounding(4)).noStroke().fill(0x0095a8).anchorAt(H.CENTER).loc(width*2/5,height/2);
        d2.add(r.createCopy()).fill(0xFF6600).locAt(H.TOP_LEFT);
        d2.add(r.createCopy()).fill(0xFF6600).locAt(H.BOTTOM_RIGHT);

        HDrawable grp1 = H.add(new HGroup()).size(50).anchorAt(H.CENTER).loc(width*3/5,height/2);
        grp1.add(r.createCopy()).fill(0xFF9900).locAt(H.TOP_LEFT);
        grp1.add(r.createCopy()).fill(0xFF9900).locAt(H.BOTTOM_RIGHT);

        HDrawable grp2 = H.add(new HGroup()).size(50).anchorAt(H.CENTER).loc(width*4/5,height/2);
        grp2.add(r.createCopy()).fill(0xFFCC00).locAt(H.TOP_LEFT);
        grp2.add(r.createCopy()).fill(0xFFCC00).locAt(H.BOTTOM_RIGHT);

        /*
         * Setting rotatesChildren to true will
         * make the children of the drawable rotate
         * but not the drawable itself.
         *
         * Unlike stylesChildren() and transformsChildren(),
         * rotatesChildren is *not* set to true in HGroups
         * by default.
         */

        d2.rotatesChildren(true);
        grp2.rotatesChildren(true);

        new HRotate(d1, 1);
        new HRotate(d2, 1);
        new HRotate(grp1, 1);
        new HRotate(grp2, 1);
    }

    public void draw() {
        H.drawStage();
    }
}
@mrd0ll4r
Copy link

I've tried this both in plain processing (3.3.7) as well as in java with the same visual result.
What exactly is not working for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants