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

Implement UiConfirm for imgui #195

Closed
wants to merge 2 commits into from
Closed

Conversation

gbsierra
Copy link
Contributor

Implemented UiConfirm for imgui

allows classic puzzles to be played

there seems to be a limit to ImGui::SetNextWindowSize(ImVec2())

@rollerozxa
Copy link
Collaborator

Crashes when testing deleting a complex object in the sandbox such as a LuaScript, which opens a confirm dialog:

#0  0x00007ffff677d05d in ?? () from /usr/lib/libc.so.6
#1  0x00007ffff696354a in std::char_traits<char>::length (__s=0x0) at /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/char_traits.h:391
#2  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign (this=0x555555bc9eb0 <UiConfirm::confirm_button3[abi:cxx11]>, __s=0x0)
    at /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:1695
#3  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator= (this=0x555555bc9eb0 <UiConfirm::confirm_button3[abi:cxx11]>, __s=0x0)
    at /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:829
#4  0x00005555559d172f in UiConfirm::open (text=0x555555731b40 <.L.str.31> "Are you sure you want to delete this object?", button1=0x555555729b75 <.L.str.2182> "Yes", action1=..., 
    button2=0x555555737122 <.L.str.22> "No", action2=..., button3=0x0, action3=...) at /run/media/rollerozxa/apZodIaL1/Principia/src/src/ui_imgui.hh:2678
#5  0x00005555559d2c59 in ui::confirm (text=0x555555731b40 <.L.str.31> "Are you sure you want to delete this object?", button1=0x555555729b75 <.L.str.2182> "Yes", action1=..., 
    button2=0x555555737122 <.L.str.22> "No", action2=..., button3=0x0, action3=..., _confirm_data=...) at /run/media/rollerozxa/apZodIaL1/Principia/src/src/ui_imgui.hh:2975
#6  0x000055555587556f in game::widget_clicked (this=0x55556513e6a0, w=0x55556621da60, button_id=9 '\t', pid=0) at /run/media/rollerozxa/apZodIaL1/Principia/src/src/game-gui.cc:1121
#7  0x00005555559ee167 in base_touch_up (w=0x55556621da60, pid=0, bid=1, ox=-16, oy=-8, rx=-0.771889865, ry=-0.389551878)
    at /run/media/rollerozxa/apZodIaL1/Principia/src/src/widget_manager.cc:73
#8  0x00005555559c2ce0 in forward_touch (s=0x55556554dc40, w=0x55556621da60, pid=0, bid=1, ox=-16, oy=-8, handler=0x5555559ee070 <base_touch_up(tms_wdg*, int, int, int, int, float, float)>)
    at /run/media/rollerozxa/apZodIaL1/Principia/src/src/tms/core/surface.c:260
#9  0x00005555559c2759 in tms_surface_handle_input (s=0x55556554dc40, ev=0x555555bb01c0 <events>, action=0) at /run/media/rollerozxa/apZodIaL1/Principia/src/src/tms/core/surface.c:396
#10 0x00005555559c0522 in tms_screen_handle_input (s=0x55556513e6a8, ev=0x555555bb01c0 <events>, action=0) at /run/media/rollerozxa/apZodIaL1/Principia/src/src/tms/core/screen.c:128
#11 0x00005555559b9556 in tms_event_process_all (s=0x55556513e6a8) at /run/media/rollerozxa/apZodIaL1/Principia/src/src/tms/core/event.c:154
#12 0x00005555559c46b1 in tms_render () at /run/media/rollerozxa/apZodIaL1/Principia/src/src/tms/core/tms.c:195
#13 0x0000555555b0f3cc in mainloop () at /run/media/rollerozxa/apZodIaL1/Principia/src/src/tms/backend/main.cc:280
#14 0x0000555555b0ef9d in main (argc=1, argv=0x7fffffffe308) at /run/media/rollerozxa/apZodIaL1/Principia/src/src/tms/backend/main.cc:184

ui::confirm is used for more than just the puzzle solution dialog, please test a couple of them to make sure they work.

@gbsierra
Copy link
Contributor Author

ui::confirm calls have been updated with consistency.
i believe crash was from confirm_button3 being set to nullptr if it was not included in ui::confirm parameters. there is now a conditional to check that
confirm data is now being updated as well. Also switched to BeginPopupModal

@rollerozxa
Copy link
Collaborator

c4a50dd

@rollerozxa rollerozxa closed this Mar 29, 2025
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

Successfully merging this pull request may close these issues.

2 participants