Skip to content

Commit

Permalink
Add Knobs classes to generation flow
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaiR committed Jan 15, 2024
1 parent 95f6069 commit 8264c7c
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package imgui.extension.imguiknobs;

import imgui.type.ImFloat;
import imgui.type.ImInt;

/**
* ImGuiKnobs extension for ImGui
* Repo: https://github.com/altschuler/imgui-knobs
*/
public final class ImGuiKnobs {

private ImGuiKnobs() {
throw new UnsupportedOperationException();
}

/*JNI
#include "_imguiknobs.h"
*/

/**
* Create a knob with float values
*
* @param label knob Label
* @param pValue knob value
* @param minValue minimum value
* @param maxValue maximum value
* @param speed speed of the knob
* @param format string format
* @param variant ImGuiKnobVariant
* @param size size of the knob
* @param flags ImGuiKnobFlags
* @param steps determines the number of steps draw, it is only used for the ImGuiKnobVariant_Stepped variant.
*/

public static boolean knobFloat(final String label, final ImFloat pValue, final float minValue, final float maxValue, final float speed, final String format, final int variant, final float size, final int flags, final int steps) {
return nKnob(label, pValue.getData(), minValue, maxValue, speed, format, variant, size, flags, steps);
}

private static native boolean nKnob(String label, float[] pValue, float minValue, float maxValue, float speed, String format, int variant, float size, int flags, int steps); /*
return ImGuiKnobs::Knob(label, pValue, minValue, maxValue, speed, format, (ImGuiKnobVariant)variant, size, (ImGuiKnobFlags)flags, steps);
*/

/**
* Create a knob with int values
*
* @param label knob Label
* @param pValue knob value
* @param minValue minimum value
* @param maxValue maximum value
* @param speed speed of the knob
* @param format string format
* @param variant ImGuiKnobVariant
* @param size Size for the knob
* @param flags ImGuiKnobFlags
* @param steps determines the number of steps draw, it is only used for the ImGuiKnobVariant_Stepped variant.
*/

public static boolean knobInt(final String label, final ImInt pValue, final int minValue, final int maxValue, final float speed, final String format, final int variant, final float size, final int flags, final int steps) {
return nKnobInt(label, pValue.getData(), minValue, maxValue, speed, format, variant, size, flags, steps);
}

private static native boolean nKnobInt(String label, int[] pValue, int minValue, int maxValue, float speed, String format, int variant, float size, int flags, int steps); /*
return ImGuiKnobs::KnobInt(label, pValue, minValue, maxValue, speed, format, (ImGuiKnobVariant)variant, size, (ImGuiKnobFlags)flags, steps);
*/

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package imgui.extension.imguiknobs.flag;

public final class ImGuiKnobFlags {

private ImGuiKnobFlags() {
}

public static final int NONE = 0;
public static final int NO_TITLE = 1;
public static final int NO_INPUT = 1 << 1;
public static final int VALUE_TOOLTIP = 1 << 2;
public static final int DRAG_HORIZONTAL = 1 << 3;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package imgui.extension.imguiknobs.flag;

public final class ImGuiKnobVariant {
private ImGuiKnobVariant() {
}
public static final int TICK = 1;
public static final int DOT = 1 << 1;
public static final int WIPER = 1 << 2;
public static final int WIPER_ONLY = 1 << 3;
public static final int WIPER_DOT = 1 << 4;
public static final int STEPPED = 1 << 5;
public static final int SPACE = 1 << 6;

}

0 comments on commit 8264c7c

Please sign in to comment.