Git Product home page Git Product logo

Comments (15)

Catvert avatar Catvert commented on May 31, 2024

I have a question, are the inputTexts supposed to work already now? Because in my projects, nothing happens when I press a key in an inputText even with active callbacks.

from imgui.

elect86 avatar elect86 commented on May 31, 2024

Yes, what are you using? Could you paste here a snippet of code?

from imgui.

Catvert avatar Catvert commented on May 31, 2024

Hi !
I am still using libGDX so the Lwjgl3 wrapper.
I initialize Lwjgl3 with :

LwjglGL3.init(GlfwWindow((Gdx.graphics as Lwjgl3Graphics).window.windowHandle), true)

I'm going to try to list all the problems I find using keyboard widgets. I use the test window (ImGui. showTestWindow) for the different tests I have performed (in widgets -> basic).

When i install callback, I can correctly enter a number on the keyboard on dragInt/dragFloat. But when I just click on an inputInt/inputFloat the program crash. With this error :
Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Scanner.java:864) at java.util.Scanner.next(Scanner.java:1485) at java.util.Scanner.nextFloat(Scanner.java:2345) at imgui.Static_funcsKt.dataTypeApplyOpFromText(static funcs.kt:599) at imgui.imgui.imgui_internal$DefaultImpls.inputScalarEx(internal.kt:2140) at imgui.ImGui.inputScalarEx(imgui.kt:27) at imgui.imgui.imgui_internal$DefaultImpls.inputScalarEx(internal.kt:2114) at imgui.ImGui.inputScalarEx(imgui.kt:27) at imgui.imgui.imgui_widgetsInputKeyboard$DefaultImpls.inputFloat(widgets inputKeyboard.kt:53) at imgui.ImGui.inputFloat(imgui.kt:27) at imgui.imgui.imgui_internal$DefaultImpls.inputFloatN(internal.kt:2075) at imgui.ImGui.inputFloatN(imgui.kt:27) at imgui.imgui.imgui_widgetsInputKeyboard$DefaultImpls.inputFloat3(widgets inputKeyboard.kt:69) at imgui.ImGui.inputFloat3(imgui.kt:27) at imgui.imgui.imgui_widgetsInputKeyboard$DefaultImpls.inputFloat3$default(widgets inputKeyboard.kt:68) at imgui.imgui.demo.widgets.invoke(widgets.kt:298) at imgui.imgui.demo.ExampleApp.invoke(ExampleApp.kt:238) at imgui.imgui.imgui_demoDebugInformations$DefaultImpls.showTestWindow(demo debug informations.kt:85) at imgui.ImGui.showTestWindow(imgui.kt:27) at imgui.imgui.imgui_demoDebugInformations$DefaultImpls.showTestWindow(demo debug informations.kt:81) at imgui.ImGui.showTestWindow(imgui.kt:27) ...

The next thing is the inputText. I can click on it and have a cursor displayed but nothing happens when I press a keyboard touch.

The last problem I encountered is I think it's related to the fact that I use libGDX with this library.
Indeed, when I install callbacks in the init function of Lwjgl3, it is impossible for me to use libGDX inputs. I cannot use functions such as Gdx.input.isKeyPressed or the Scene2D. I think the problem is that the install callbacks function replaces all callbacks that libGDX already uses on the window. If necessary, I can try to create my own wrapper for libGDX using an InputMultiplexer for example.

I hope to have been quite clear despite my low level of English. Thanks to you, Catvert.

from imgui.

Catvert avatar Catvert commented on May 31, 2024

Any feedback? :)

from imgui.

elect86 avatar elect86 commented on May 31, 2024

Yes,

sorry for the delay but I'm trying to finish the fbx support for assimp asap

Anyway, the InputMismatchException happened because of a locale mismatch, now the Scanner (used to parse the input) will use the locale set in style.locale, which on start will be the java default locale

inputText is working for me.. can you test the demo under Widgets -> Text -> JVM UTF-16 -> try to type there

At the moment if you pass true in LwjglGL3.init() imgui will install its callbacks (overwriting what is there).. and the thing is, you can only have a single callback per type per time.

we are discussing here, to create support out-of-the-box for multiple callbacks of the same type. In the meanwhile, pass false and call each imgui callback manually from your application callbacks

from imgui.

Catvert avatar Catvert commented on May 31, 2024

Hi !
First of all, thank you again for your work. That's excellent!
I don't have any more problems with the InputMismatchException !

I've created the callback adapter for inputs for libGDX, I'll post my results in the wiki (if you can take a look at it when I add it).

I have one last little problem, which has nothing to do with the previous problems. I noticed that you are using a CharArray (CharArray (size)) for the inputText buffer in UTF-16. How can I later translate this buffer to convert it into string?
Thanks to you, Catvert.

from imgui.

elect86 avatar elect86 commented on May 31, 2024

Yup, you are welcome :)

I'll try to remember to take a look, maybe you can "up" here to notify

String(CharArray), they offer a constructor accepting char array to build a string

from imgui.

Catvert avatar Catvert commented on May 31, 2024

Oh yes it's working, it was another error in my code.
I just finished writing it!

from imgui.

elect86 avatar elect86 commented on May 31, 2024

It looks perfect, thanks

from imgui.

Catvert avatar Catvert commented on May 31, 2024

Thanks to you too! :)

from imgui.

Catvert avatar Catvert commented on May 31, 2024

Hi !
I found an another issue. When I want to put a negative number in an inputInt, if there is no number in the field and I add a minus sign, the program crashes with an InputMismatchException from the Scanner.

from imgui.

Sylvyrfysh avatar Sylvyrfysh commented on May 31, 2024

stacktrace? code?

from imgui.

Catvert avatar Catvert commented on May 31, 2024

Hi ! This is the stacktrace, when I put a minus sign on an empty inputInt in the demo window :
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Scanner.java:864)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at imgui.Static_funcsKt.dataTypeApplyOpFromText(static funcs.kt:577)
at imgui.imgui.imgui_internal$DefaultImpls.inputScalarEx(internal.kt:2135)
at imgui.ImGui.inputScalarEx(imgui.kt:27)
at imgui.imgui.imgui_widgetsInputKeyboard$DefaultImpls.inputInt(widgets inputKeyboard.kt:92)
at imgui.ImGui.inputInt(imgui.kt:27)
at imgui.imgui.imgui_widgetsInputKeyboard$DefaultImpls.inputInt$default(widgets inputKeyboard.kt:88)
at imgui.imgui.demo.widgets.invoke(widgets.kt:312)
at imgui.imgui.demo.ExampleApp.invoke(ExampleApp.kt:234)
at imgui.imgui.imgui_demoDebugInformations$DefaultImpls.showDemoWindow(demo debug informations.kt:86)
at imgui.ImGui.showDemoWindow(imgui.kt:27)
at imgui.imgui.imgui_demoDebugInformations$DefaultImpls.showDemoWindow(demo debug informations.kt:82)
at imgui.ImGui.showDemoWindow(imgui.kt:27)

from imgui.

Sylvyrfysh avatar Sylvyrfysh commented on May 31, 2024

#23 fixes

from imgui.

Catvert avatar Catvert commented on May 31, 2024

Nice work thanks !

from imgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.