I’m currently writing a bit of code I want to reuse in other projects. It’s a GUI framework. The problem is that I don’t want to constantly keep typing in a specific line of code every single time I start using whatever feature I need from each function. The solution was simple enough, I created an update function(stub), but now I need to run a function to add the new object to the code automatically upon the creation of the object. How would I achieve this? I want to do this in JuiceUI, and not JuiceUI_Example The code is below, albeit quite poorly made.
JuiceUI_Example(main file)
JuiceUI example = new JuiceUI();
JuiceUI.button ButtonA = example.new button();
void setup() {
size(640,480);
surface.setTitle("JuiceUI Testing Program!");
surface.setResizable(true);
surface.setLocation(100, 100);
frameRate(60);
//Button A setup
}
void draw() {
ButtonA.disable = false;
if (frameCount%30==0) {
example.update();
print("ButtonA", ButtonA.disable, "\n");
}
}
JuiceUI(the framework I’m writing)
public class JuiceUI {
void update() {
print("Update has been called at frame", frameCount, "\n");
}
//Button manipulation
public class button {
public float posx = 0;
public float posy = 0;
int sizex = 100;
int sizey = 50;
String text;
boolean disable = false;
byte status = -127;
void autorun() {
}
}
}