Kraken Community ImGui in Java - RSKrakenCommunity/CommunityAPI GitHub Wiki
ImGui module requires Java 8
import com.rshub.api.plugin.JavaPlugin;
import com.rshub.imgui.nodes.pane.panes.VerticalPane;
public class ImGuiExample extends JavaPlugin {
public ImGuiExample() {
super("ImGui Example");
}
@Override
public int onLoop() {
return super.onLoop();
}
private VerticalPane vpane = new VerticalPane();
@Override
protected void onLoad() {
}
@Override
public void onPaint() {
vpane.getSkin().paint();
}
}
import com.rshub.imgui.nodes.button.Button;
Button button = new Button("Click me!");
vpane.add(button);
Button button = new Button("Click me!");
SimpleStringProperty btnText = new SimpleStringProperty();
button.getLabelProperty().bind(btnText);
btnText.set("Better Click me!");
Button button = new Button("Click me!");
button.setOnAction(() -> {
Debug.log("Clicked me!");
return Unit.INSTANCE;
});
import com.rshub.imgui.nodes.label.Label;
Label label = new Label("XP Gained: 0");
SimpleIntegerProperty xp = new SimpleIntegerProperty();
label.getLabelProperty().bind(Bindings.createStringBinding(() -> "XP Gained: " + xp.get(), xp));
xp.set(xp.get() + 1000);
import com.rshub.imgui.nodes.tabs.Tab;
import com.rshub.imgui.nodes.tabs.TabPane;
TabPane tp = new TabPane("Debug Tabs");
Tab tab = new Tab("Player");
tp.addTab(tab);
vpane.add(tp);
VerticalPane playerTabContent = new VerticalPane();
playerTabContent.add(new Label("Player name: Bob"));
tab.setContent(playerTabContent);
import com.rshub.imgui.nodes.inputs.integer.IntegerInput;
import com.rshub.imgui.nodes.inputs.text.PasswordField;
import com.rshub.imgui.nodes.inputs.text.TextField;
IntegerInput ii = new IntegerInput("Enter Item Id");
SimpleIntegerProperty value = new SimpleIntegerProperty();
ii.getInput().bind(value);
value.set(50);
TextField textf = new TextField("Enter name", 50);
SimpleStringProperty text = new SimpleStringProperty();
textf.getInput().bind(text);
text.set("Hello, World");
PasswordField passf = new PasswordField("Enter Password");
SimpleStringProperty text = new SimpleStringProperty();
passf.getInput().bind(text);
text.set("Hello, World");
import com.rshub.imgui.nodes.checkbox.Checkbox;
Checkbox box = new Checkbox("Collect Spirits");
SimpleBooleanProperty value = new SimpleBooleanProperty();
box.getInput().bind(value);
value.set(true);