feat: ArgVariant annotation and plot methods with count parameter (#264)
* feat(generator): introduce ArgVariant annotation New annotation provides an ability to generate methods definitions for different types and names. * feat(api): expose count param for plot* methods
This commit is contained in:
1 parent
cae0581df2
commit
9518b1cec6
8 files changed
+7605
-1785
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -2,6 +2,7 @@ package imgui;
|
||||
|
||||
import imgui.assertion.ImAssertCallback;
|
||||
import imgui.binding.annotation.ArgValue;
|
||||
import imgui.binding.annotation.ArgVariant;
|
||||
import imgui.binding.annotation.BindingMethod;
|
||||
import imgui.binding.annotation.BindingSource;
|
||||
import imgui.binding.annotation.OptArg;
|
||||
@@ -1493,34 +1494,23 @@ public class ImGui {
|
||||
public static native boolean InputDouble(String label, ImDouble v, @OptArg double step, @OptArg double stepFast, @OptArg(callValue = "\"%.6f\"") String format, @OptArg int imGuiInputTextFlags);
|
||||
|
||||
@BindingMethod
|
||||
public static native boolean InputScalar(String label, Void ImGuiDataType_S16, ImShort pData, @OptArg @ArgValue(callPrefix = "&") short pStep, @OptArg @ArgValue(callPrefix = "&") short pStepFast, @OptArg String format, @OptArg int imGuiSliderFlags);
|
||||
public static native boolean InputScalar(String label,
|
||||
@ArgVariant(name = {"ImGuiDataType_S16", "ImGuiDataType_S32", "ImGuiDataType_S64", "ImGuiDataType_Float", "ImGuiDataType_Double"}) Void __,
|
||||
@ArgVariant(type = {"ImShort", "ImInt", "ImLong", "ImFloat", "ImDouble"}) Void pData,
|
||||
@ArgVariant(type = {"short", "int", "long", "float", "double"}) @OptArg @ArgValue(callPrefix = "&") Void pStep,
|
||||
@ArgVariant(type = {"short", "int", "long", "float", "double"}) @OptArg @ArgValue(callPrefix = "&") Void pStepFast,
|
||||
@OptArg String format,
|
||||
@OptArg int imGuiSliderFlags);
|
||||
|
||||
@BindingMethod
|
||||
public static native boolean InputScalar(String label, Void ImGuiDataType_S32, ImInt pData, @OptArg @ArgValue(callPrefix = "&") int pStep, @OptArg @ArgValue(callPrefix = "&") int pStepFast, @OptArg String format, @OptArg int imGuiSliderFlags);
|
||||
|
||||
@BindingMethod
|
||||
public static native boolean InputScalar(String label, Void ImGuiDataType_S64, ImLong pData, @OptArg @ArgValue(callPrefix = "&") long pStep, @OptArg @ArgValue(callPrefix = "&") long pStepFast, @OptArg String format, @OptArg int imGuiSliderFlags);
|
||||
|
||||
@BindingMethod
|
||||
public static native boolean InputScalar(String label, Void ImGuiDataType_Float, ImFloat pData, @OptArg @ArgValue(callPrefix = "&") float pStep, @OptArg @ArgValue(callPrefix = "&") float pStepFast, @OptArg String format, @OptArg int imGuiSliderFlags);
|
||||
|
||||
@BindingMethod
|
||||
public static native boolean InputScalar(String label, Void ImGuiDataType_Double, ImDouble pData, @OptArg @ArgValue(callPrefix = "&") double pStep, @OptArg @ArgValue(callPrefix = "&") double pStepFast, @OptArg String format, @OptArg int imGuiSliderFlags);
|
||||
|
||||
@BindingMethod
|
||||
public static native boolean InputScalarN(String label, Void ImGuiDataType_S16, short[] pData, int components, @OptArg @ArgValue(callPrefix = "&") short pStep, @OptArg @ArgValue(callPrefix = "&") short pStepFast, @OptArg String format, @OptArg int imGuiSliderFlags);
|
||||
|
||||
@BindingMethod
|
||||
public static native boolean InputScalarN(String label, Void ImGuiDataType_S32, int[] pData, int components, @OptArg @ArgValue(callPrefix = "&") int pStep, @OptArg @ArgValue(callPrefix = "&") int pStepFast, @OptArg String format, @OptArg int imGuiSliderFlags);
|
||||
|
||||
@BindingMethod
|
||||
public static native boolean InputScalarN(String label, Void ImGuiDataType_S64, long[] pData, int components, @OptArg @ArgValue(callPrefix = "&") long pStep, @OptArg @ArgValue(callPrefix = "&") long pStepFast, @OptArg String format, @OptArg int imGuiSliderFlags);
|
||||
|
||||
@BindingMethod
|
||||
public static native boolean InputScalarN(String label, Void ImGuiDataType_Float, float[] pData, int components, @OptArg @ArgValue(callPrefix = "&") float pStep, @OptArg @ArgValue(callPrefix = "&") float pStepFast, @OptArg String format, @OptArg int imGuiSliderFlags);
|
||||
|
||||
@BindingMethod
|
||||
public static native boolean InputScalarN(String label, Void ImGuiDataType_Double, double[] pData, int components, @OptArg @ArgValue(callPrefix = "&") double pStep, @OptArg @ArgValue(callPrefix = "&") double pStepFast, @OptArg String format, @OptArg int imGuiSliderFlags);
|
||||
public static native boolean InputScalarN(String label,
|
||||
@ArgVariant(name = {"ImGuiDataType_S16", "ImGuiDataType_S32", "ImGuiDataType_S64", "ImGuiDataType_Float", "ImGuiDataType_Double"}) Void __,
|
||||
@ArgVariant(type = {"short[]", "int[]", "long[]", "float[]", "double[]"}) Void pData,
|
||||
int components,
|
||||
@ArgVariant(type = {"short", "int", "long", "float", "double"}) @OptArg @ArgValue(callPrefix = "&") Void pStep,
|
||||
@ArgVariant(type = {"short", "int", "long", "float", "double"}) @OptArg @ArgValue(callPrefix = "&") Void pStepFast,
|
||||
@OptArg String format,
|
||||
@OptArg int imGuiSliderFlags);
|
||||
|
||||
// Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little color square that can be left-clicked to open a picker, and right-clicked to open an option menu.)
|
||||
// - Note that in C++ a 'float v[X]' function argument is the _same_ as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible.
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package imgui.binding.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Provides a sort of pre-processing experience, to generate method with additional argument variants.
|
||||
* Can generate methods with different arg type and different arg names.
|
||||
* Intended to be used for methods with template arguments.
|
||||
* {@link #type} and {@link #name()} arrays SHOULD have the same length.
|
||||
*/
|
||||
@ExcludedSource
|
||||
@Target(ElementType.PARAMETER)
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface ArgVariant {
|
||||
/**
|
||||
* Variant for the argument type.
|
||||
*/
|
||||
String[] type() default {};
|
||||
|
||||
/**
|
||||
* Variant for the argument name.
|
||||
*/
|
||||
String[] name() default {};
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user