kotlin-graphics / imgui

Bloat-free Immediate Mode Graphical User interface for JVM with minimal dependencies (rewrite of dear imgui)
MIT License
600 stars 36 forks source link

1.77 available #155

Closed elect86 closed 3 years ago

elect86 commented 4 years ago

I just completed and merged 1.77 back into master (-jdk8 variant as well)

Feel free to try out and leave some feedbacks in case of bug or features

gurachan commented 4 years ago

will u update the kotlin to 1.4.10 ... after this IntelliJ update 1.4.0 to 1.4.10 .. it pops up I thought its a good thing ... now I'm having this error. it's my mistake to update. I don't know how to downgrade.. xD I can only select 1.4 1.3 etc.. and 1.4.10 is technically 1.4

java.lang.LinkageError: loader constraint violation: when resolving method "imgui.ImGui.begin(Ljava/lang/String;Lkotlin/reflect/KMutableProperty0;I)Z" the class loader (instance of net/fabricmc/loader/launch/knot/KnotClassLoader) of the current class, net/aaa/bbbb/gui/screen/ModScreen, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class, imgui/ImGui, have different Class objects for the type kotlin/reflect/KMutableProperty0 used in the signature

error occur when i use this

MutableProperty0<Boolean> show_console = new MutableProperty0<Boolean>(false);

it works before tho I dint even touch anything. ngl I don't understand what is that error above xD

 imgui/ImGui, have different Class objects for the type kotlin/reflect/KMutableProperty0 used in the signature
gurachan commented 4 years ago

after updating to 1.77 btw just now I receive this

java.lang.NoSuchMethodError: uno.glfw.GlfwWindow.getHandle()J
    at imgui.impl.glfw.ImplGlfw.<init>(ImplGlfw.kt:79)

hmmmmm xD wait i see you update again in 15mins ago.. leme try to redownload..

update: sad its broken yeet :( still no such method NoSuchMethodError... its imported tho .. because the error is at imgui.impl.glfw.ImplGlfw ... now it cant see the uno.glfw.GlfwWindow.getHandle()

image

elect86 commented 4 years ago

There seems to be some issues with kotlin reflect, I directly updated to 1.4.10, the example runs fine (branch jdk8-1.4.10)

Give it a try.

Also, NoSuchMethodError suggests your project is using an old uno, pull explicitely against 2599943c

gurachan commented 4 years ago

There seems to be some issues with kotlin reflect, I directly updated to 1.4.10, the example runs fine (branch jdk8-1.4.10)

Give it a try.

Also, NoSuchMethodError suggests your project is using an old uno, pull explicitely against 2599943c

I invalidate the cache and restart. also tried to delete those jars so Gradle will forcely download the jar again.. how do i fix not using old uno?


    ["gl", "glfw", "core"].each {
        implementation("com.github.kotlin-graphics.imgui:imgui-$it:jdk8-SNAPSHOT") {
            exclude group: "org.lwjgl"
        }
    }

    implementation "com.github.kotlin-graphics:uno-sdk:jdk8-SNAPSHOT"
    implementation "com.github.kotlin-graphics:glm:jdk8-SNAPSHOT"
    implementation group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: '1.4.10'

so its a jdk8_1.4.10-SNAPSHOT now? wait im going to try that...

update: it doesnt work xD wait do I remove the snapshot. what changes?

i did this

   ["gl", "glfw", "core"].each {
        implementation("com.github.kotlin-graphics.imgui:imgui-$it:jdk8_1.4.10-SNAPSHOT") {
            exclude group: "org.lwjgl"
        }
    }

    implementation "com.github.kotlin-graphics:uno-sdk:jdk8_1.4.10-SNAPSHOT"
    implementation "com.github.kotlin-graphics:glm:jdk8_1.4.10-SNAPSHOT"
    implementation group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: '1.4.10'

it dint download it.. now all the imgui library is missing.. i think im missing something

all of it got

Could not find com.github.kotlin-graphics:glm:jdk8_1.4.10-SNAPSHOT. Searched in the following locations:

it tries on

mavenLocal()
    jcenter()
    mavenCentral()
    maven {
        url = "https://jitpack.io"
    }
    maven {
        url "https://dl.bintray.com/shedaniel/autoconfig1u/"
    }

dint find any

.........

update .. wait i think its ... i thought tree = branch xD jdk8_1.4.10.. i re read your msg above it says branch: :jdk8-1.4.10

ok i will try in :jdk8_1.4.10 hold on.............

hmmm nope image

i will try again without snapshot

gurachan commented 4 years ago

I can't download it.. hmm what did I miss xD

image

elect86 commented 4 years ago
["gl", "glfw", "core"].each {
        implementation("com.github.kotlin-graphics.imgui:$it:4603278f") { // let be explicit here, also now it's just "imgui:$it" instead "imgui:imgui-$it", I'm gonna update the wiki
            exclude group: "org.lwjgl"
        }
}

implementation "com.github.kotlin-graphics:uno-sdk:2599943c" let's be explicit here as well

Please note that the autobuild features on push on Jitpack is not reliable, so when you are the very first to pull a commit and this isn't available (ie: build yet), that attempt will probably fail because of timeout, so you have to pull it once again (because in the meanwhile Jitpack has completed). You can follow the status directly on https://jitpack.io/#kotlin-graphics/imgui

gurachan commented 4 years ago

oooo thats new btw I think it failed to build "https://jitpack.io/com/github/kotlin-graphics/imgui/jdk8_1.4.10-1e22d55958-1/build.log"

but I will try that 4603278f

gurachan commented 4 years ago

hmm last error? glm? i put 2599943c xD

image

is glm same? like jdk8-snapshot?

elect86 commented 4 years ago

use 557908c3 for glm

gurachan commented 4 years ago

use 557908c3 for glm

i did that now i have this image

is it because I exclude this?

 ["gl", "glfw", "core"].each {
        implementation("com.github.kotlin-graphics.imgui:$it:4603278f") {
            exclude group: "org.lwjgl"
        }
    }

but I can't un exclude it because I use it in Minecraft. Minecraft has its own lwjgl. and i really dint change anything on my graddle this all works before even i exclude it

Could not find org.lwjgl:lwjgl-opengles:.
Required by:
    project : > com.github.kotlin-graphics.imgui:gl:4603278f > com.github.kotlin-graphics:gln:2c26a366

Could not find org.lwjgl:lwjgl-jawt:.
Required by:
    project : > com.github.kotlin-graphics:uno-sdk:2599943c > com.github.kotlin-graphics.uno-sdk:awt:2599943c

Could not find org.lwjgl:lwjgl-vulkan:.
Required by:
    project : > com.github.kotlin-graphics:uno-sdk:2599943c > com.github.kotlin-graphics.uno-sdk:vk:2599943c
    project : > com.github.kotlin-graphics:uno-sdk:2599943c > com.github.kotlin-graphics.uno-sdk:vk:2599943c > com.github.kotlin-graphics:vkk:ae17e732
elect86 commented 4 years ago

Well, actually (I suppose) you don't need opengles, jawt or vulkan

We may try with a custom branch only for Minecraft, if you want

gurachan commented 4 years ago

hmm

Error:(133, 12) java: cannot access imgui.MutableProperty0
  bad class file: /C:/Users/myname/.gradle/caches/modules-2/files-2.1/com.github.kotlin-graphics.imgui/core/4603278f/148dd2469b6ea50036ff11010d732c69ca7cd2cc/core-4603278f.jar!/imgui/MutableProperty0.class
    class file has wrong version 55.0, should be 52.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.

this was fixed before. its comeback again. if i recall this MutableProperty0 is for java 8 to use KMutableProperty0

is that connected to this error?

if (UI.beginTabItem("sample", null, no_close_tab)) {} // it points to here

image

Caused by: java.lang.LinkageError: loader constraint violation:
 when resolving method "imgui.ImGui.beginTabItem(Ljava/lang/String;Lkotlin/reflect/KMutableProperty0;I)Z" 
the class loader (instance of net/fabricmc/loader/launch/knot/KnotClassLoader) of the current class,
net/lovely/gui/component/screen/TabBar, 
and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class,
 imgui/ImGui, 
have different Class objects for the type kotlin/reflect/KMutableProperty0 used in the signature

they both complaining about KMutableProperty0.. the MutableProperty0 is also using KMutableProperty0.. is it because of the class version 55.0, should be 52.0?

Well, actually (I suppose) you don't need opengles, jawt or vulkan

We may try with a custom branch only for Minecraft, if you want

wow very thanks if we had xD our own branch for Minecraft <3

.......... the directory plugins looks neat now,,, image

better than before.. but yeah.. i really need a fix for kmutable thingy :( why is it complaining about it.

......

I even copy the class MutableProperty0 to mine and name it mutation haha so its java 8 now but yeah u still need to import that KMutableProperty0. it's still complaining about KMutableProperty0.. it was working before I don't know xD why .. I'm almost at 60% on the project to prove its working fine to use the mutation class aka MutableProperty0 ...

elect86 commented 4 years ago

Error:(133, 12) java: cannot access imgui.MutableProperty0 bad class file: /C:/Users/myname/.gradle/caches/modules-2/files-2.1/com.github.kotlin-graphics.imgui/core/4603278f/148dd2469b6ea50036ff11010d732c69ca7cd2cc/core-4603278f.jar!/imgui/MutableProperty0.class class file has wrong version 55.0, should be 52.0 Please remove or make sure it appears in the correct subdirectory of the classpath.

No idea where is getting the compatibility version for the Java from.. anyway, I just explicitely required 1.8: 2ab61709

Let's see if it's connected to the other error, otherwise we'll go down with a custom branch

gurachan commented 4 years ago

The last resort I can do is to go back with

public boolean begin(@NotNull String name,
                     @NotNull boolean[] pOpen,
                     int flags)

the boolean[] and not KMutableProperty0 one.. the KMutableProperty0 one looks neat but I guess i have to use the array again xD .. also I will keep my eye peeled on your updates :)

I will wait until 2ab6170 is up. lets see.. im watching https://jitpack.io/#kotlin-graphics/imgui

elect86 commented 4 years ago

Anyway, is your project public?

gurachan commented 4 years ago

Anyway, is your project public?

nope, it's private I can give u access or I guess i can make a repo. that we can play around. after I eat.. that's easy to reproduce. :)

gurachan commented 4 years ago

I think its fixed or isnt? xD well i runs fine with some few issues.. but.. no combo filter

Fresh setup .. fresh everything.. u still can't use MutableProperty0 directly.. but it works now if you copy and paste it on your source code .. and name it somethign else like KotlinMutation.. to prevent class 52 error thingy

so whats in my C:\,........................gradle\caches\modules-2\files-2.1\com.github.kotlin-graphics.imgui\core\4603278f\b5497481b532f7da4fd3308203013589cb1a27d7

the "4603278f" exist so it means im using it

when i try to trace the declaration of combo.. just to see if the combofilter is there nope


/** Widgets: Combo Box
 *  - The BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() items.
 *  - The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose.    */
interface widgetsComboBox {

    fun beginCombo(label: String, previewValue: String?, flags_: ComboFlags = 0): Boolean {
        .............
    }

    /** Only call EndCombo() if BeginCombo() returns true! */
    fun endCombo() = endPopup()

    /** Combo box helper allowing to pass an array of strings.  */
    fun combo(label: String, currentItem: KMutableProperty0<Int>, items: Array<String>, heightInItems: Int = -1): Boolean =
            combo(label, currentItem, items.toList(), heightInItems)

    /** Combo box helper allowing to pass all items in a single string literal holding multiple zero-terminated items "item1\0item2\0" */
    fun combo(label: String, currentItem: IntArray, itemsSeparatedByZeros: String, heightInItems: Int = -1): Boolean {
      .............
    }

    fun combo(label: String, currentItem: KMutableProperty0<Int>, itemsSeparatedByZeros: String, heightInItems: Int = -1): Boolean {
       .............
    }

    /** Combo box function. */
    fun combo(label: String, currentItem: IntArray, items: List<String>, popupMaxHeightInItem: Int = -1): Boolean {
       .............
    }

    fun combo(label: String, currentItemPtr: KMutableProperty0<Int>, items: List<String>, popupMaxHeightInItem: Int = -1): Boolean {

       ............
    }

    /** Old API, prefer using BeginCombo() nowadays if you can. */
    fun combo(label: String, pCurrentItem: KMutableProperty0<Int>, itemsGetter: (Array<String>, Int, KMutableProperty0<String>) -> Boolean,
              items: Array<String>, popupMaxHeightInItems: Int = -1): Boolean {
            .............
    }

    ..............
}

its not exist...

image image

btw here's the repo that we can play https://github.com/Dj-jom2x/fabric-kotlin-graphics

elect86 commented 4 years ago

Sorry, my bad, I messed up and left it in master only, it should be there with 43281293

gurachan commented 4 years ago

4328129

kewl I will wait for it on 'https://jitpack.io/#kotlin-graphics/imgui', right? aight I'm going to wait.

elect86 commented 4 years ago

You need to pull once to trigger the build though

gurachan commented 4 years ago

4328129 commit fixes the MutableProperty0 usage in java 8 ... thanks.. about combo filter...

Am I doing it right in java?

    byte[] lol = new byte[256];

    String[] hint = new String[]{"hello", "hi", "what"};

    ComboFilterState state = new ComboFilterState();

......... render function
 if (comboFilter("yeah", lol, hint, state, 0)) {

 }

it looks like this

image

overall it looks lit.. <3 the last thing we need to work is filtering.

I think i will move at https://github.com/kotlin-graphics/imgui/issues/145 now since 1.77 is lit already,.

elect86 commented 4 years ago

ah, you want it to filter and cut out what it doesnt match..

the way it is implemented now is jumping directly to the match

Also, it's closed by default.. do you see it open?

gurachan commented 4 years ago

sorry late reply

ah, you want it to filter and cut out what it doesnt match..

~ yeah and gather all stuff that slight match on that search.. maybe optional.

Also, it's closed by default.. do you see it open?

~ yes on java that code above posted makes it automatically open at first and u are forced to select something else it stays open. but in kotlin it works perfectly great

elect86 commented 4 years ago

weird.. is your playground project updated?

elect86 commented 3 years ago

I'm closing this since 1.77 has been just released

@Dj-jom2x if you want we cant continue nonetheless..