Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2nd example in readme.md throws DivideError #23

Open
bjuergens opened this issue May 7, 2022 · 4 comments
Open

2nd example in readme.md throws DivideError #23

bjuergens opened this issue May 7, 2022 · 4 comments

Comments

@bjuergens
Copy link

hi.

the first example works like a charm. The 2nd one gives me an error despite appearing to be simpler.

reproduction

### make sure everything is setup properly

using Pkg
Pkg.add("Poptart")
Pkg.update("Poptart")
Pkg.status("Poptart")
Pkg.status("CImGui")


### copy past from readme

using Poptart.Desktop # Application Window InputText Button didClick

window1 = Window()
app = Application(windows = [window1])

input1 = InputText(label="Subject", buf="")
button1 = Button(title = "submit")
push!(window1.items, input1, button1)

didClick(button1) do event
    @info :didClick (event, input1.buf)
end

Desktop.exit_on_esc() = true
!isinteractive() && wait(app.closenotify)

output:

$ julia mve.jl 
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.7/Project.toml`
  No Changes to `~/.julia/environments/v1.7/Manifest.toml`
    Updating registry at `~/.julia/registries/General.toml`
  No Changes to `~/.julia/environments/v1.7/Project.toml`
  No Changes to `~/.julia/environments/v1.7/Manifest.toml`
      Status `~/.julia/environments/v1.7/Project.toml`
  [197b51f5] Poptart v0.3.2
      Status `~/.julia/environments/v1.7/Project.toml`
  [5d785b6c] CImGui v1.79.0
┌ Error: Error in renderloop!
│   exception = DivideError: integer division error
└ @ Poptart.Desktop ~/.julia/packages/Poptart/RbjXy/src/Desktop/glfw.jl:42

Stacktrace:
 [1] div
   @ ./int.jl:284 [inlined]
 [2] divrem
   @ ./div.jl:162 [inlined]
 [3] divrem
   @ ./div.jl:158 [inlined]
 [4] rpad(s::String, n::Int64, p::Char)
   @ Base ./strings/util.jl:382
 [5] imgui_control_item(imctx::Ptr{CImGui.LibCImGui.ImGuiContext}, item::InputText)
   @ Poptart.Desktop ~/.julia/packages/Poptart/RbjXy/src/Desktop/imgui_controls.jl:29
 [6] setup_window(ctx::Ptr{CImGui.LibCImGui.ImGuiContext}, window::Window)
   @ Poptart.Desktop ~/.julia/packages/Poptart/RbjXy/src/Desktop/window.jl:67
 [7] setup_app(app::Application)
   @ Poptart.Desktop ~/.julia/packages/Poptart/RbjXy/src/Desktop/application.jl:67
 [8] runloop(glwin::GLFW.Window, ctx::Ptr{CImGui.LibCImGui.ImGuiContext}, glsl_version::Int64, push_window::typeof(Poptart.Desktop.setup_app), app::Application)
   @ Poptart.Desktop ~/.julia/packages/Poptart/RbjXy/src/Desktop/glfw.jl:28
 [9] (::Poptart.Desktop.var"#37#38"{Application, Int64, Ptr{CImGui.LibCImGui.ImGuiContext}, GLFW.Window})()
   @ Poptart.Desktop ./task.jl:423%                             
@bjuergens
Copy link
Author

when I change remove the "null" from this line it seems to work

nullpad_buf = rpad(item.buf, item.buf_size, null)

@L1ghtingBolt
Copy link

L1ghtingBolt commented Dec 4, 2022

Still happening to me in the latest version.
Status 'C:\Users\gerar\.julia\environments\v1.8\Project.toml' [197b51f5] Poptart v0.3.2

@wookay
Copy link
Owner

wookay commented Dec 4, 2022

well, could you use the develop version of Poptart?

using Pkg
Pkg.develop("CImGui")
Pkg.develop("Poptart")

some problems here,
there needs to update for using CImGui_jll instead of CImGui
https://github.com/JuliaRegistries/General/blob/master/C/CImGui_jll/Versions.toml

so it should be a lot works that's based on CImGui_jll 1.82

thanks for report.

@L1ghtingBolt
Copy link

well, could you use the develop version of Poptart?

using Pkg
Pkg.develop("CImGui")
Pkg.develop("Poptart")

some problems here, there needs to update for using CImGui_jll instead of CImGui https://github.com/JuliaRegistries/General/blob/master/C/CImGui_jll/Versions.toml

so it should be a lot works that's based on CImGui_jll 1.82

thanks for report.

Seems the development version uses a different syntax
ERROR: LoadError: UndefVarError: ImGuiConfigFlags_ViewportsEnable not defined
Stacktrace:
[1] include(mod::Module, _path::String)
@ Base .\Base.jl:419
[2] include(x::String)
@ Poptart C:\Users\gerar.julia\dev\Poptart\src\Poptart.jl:1
[3] top-level scope
@ C:\Users\gerar.julia\dev\Poptart\src\Poptart.jl:4
in expression starting at C:\Users\gerar.julia\dev\Poptart\src\Desktop.jl:1
in expression starting at C:\Users\gerar.julia\dev\Poptart\src\Poptart.jl:1

ERROR: UndefVarError: Window not defined
Stacktrace:
[1] top-level scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants