X Tutup
Skip to content

doubleclick pause for options#5279

Merged
sturnclaw merged 9 commits intopioneerspacesim:masterfrom
joonicks:pause-options
Oct 1, 2021
Merged

doubleclick pause for options#5279
sturnclaw merged 9 commits intopioneerspacesim:masterfrom
joonicks:pause-options

Conversation

@joonicks
Copy link
Contributor

accessibility: open options by mouse actions

instead of needing keyboard + mouse

@impaktor
Copy link
Member

impaktor commented Sep 25, 2021

Is pause button the "right place" to put options toggling? Doesn't pause usually toggle pause/unpause?
I know we also have the play button, but just thinking about what's players expect.

Alternative solution:

  • click pixel 0,0 / (top left corner)
  • right click pause
  • right click somewhere else?
  • pause automatically opens options menu? (So one doesn't do in-game actions when paused, as that could be considered cheating, or unrealistic)

@nozmajner thoughts?

EDIT: Ah, re-reading the title, I assume double click isn't same as toggle, if so, then please disregard my text above.

@bszlrd
Copy link
Contributor

bszlrd commented Sep 25, 2021

It was on the pause button in Frontier as far as I can remember. Or rather it turned into a stop button that would bring the settings up. Which made sense to me back then.
In our case pause isn't toggling play. Which I don't see as a problem.
I think pause alone shouldn't bring up the settings. If we want to keep the player from doing any interaction, then maybe gray up the interface stuff that wouldn't work? And for screenshots, the ability to be able to compose while paused is very handy.

@joonicks
Copy link
Contributor Author

altered as requested

@impaktor pause button does not toggle (in pioneer)

enforcing options to be open always on pause would interfere with screenshots

@impaktor
Copy link
Member

Have the requested changes by @Web-eWorks been addressed?
If so, I assume this is ready for merge?

@joonicks
Copy link
Contributor Author

@impaktor the changes have been made but now for some reason "IsMouseDoubleClicked" doesnt exist on my copy of pioneer. im baffled.

@joonicks
Copy link
Contributor Author

@impaktor simply reversing the order made it exist again. pigui is a fickle beast!

@zonkmachine
Copy link
Member

"IsMouseDoubleClicked" doesnt exist on my copy of pioneer. im baffled.

I get Fatal: [string "[T] @pigui/modules/time-window.lua"]:50: attempt to call field 'isMouseDoubleClicked' (a nil value) on all versions since d06b656. I just assume the chance the error is on my side is pretty big but I can't make this work.

@joonicks
Copy link
Contributor Author

@zonkmachine is that with patch "unknown issue" of this patch?

@zonkmachine
Copy link
Member

Yes, with that one too, but the issue shows up in one way or the other since the introduction of IsMouseDoubleClicked

@joonicks
Copy link
Contributor Author

changed it back to manual doubleclick

@zonkmachine
Copy link
Member

zonkmachine commented Sep 28, 2021

OK, I think I found it. There is no isMouseDoubleClicked in a/src/lua/LuaPiGui.cpp and /data/pigui/libs/forwarded.lua so it simply hasn't been introduced yet. I tested with this code and it seem to work.

diff --git a/data/pigui/libs/forwarded.lua b/data/pigui/libs/forwarded.lua
index aca3706ef..af377f37d 100644
--- a/data/pigui/libs/forwarded.lua
+++ b/data/pigui/libs/forwarded.lua
@@ -54,6 +54,7 @@ ui.getTextLineHeightWithSpacing = pigui.GetTextLineHeightWithSpacing
 ui.lowThrustButton = pigui.LowThrustButton
 ui.thrustIndicator = pigui.ThrustIndicator
 ui.isMouseClicked = pigui.IsMouseClicked
+ui.isMouseDoubleClicked = pigui.IsMouseDoubleClicked
 ui.isMouseDown = pigui.IsMouseDown
 ui.getMousePos = pigui.GetMousePos
 ui.getMouseWheel = pigui.GetMouseWheel
diff --git a/src/lua/LuaPiGui.cpp b/src/lua/LuaPiGui.cpp
index 42d26744e..6dc982ec2 100644
--- a/src/lua/LuaPiGui.cpp
+++ b/src/lua/LuaPiGui.cpp
@@ -1517,6 +1517,14 @@ static int l_pigui_is_mouse_clicked(lua_State *l)
        return 1;
 }
 
+static int l_pigui_is_mouse_doubleclicked(lua_State *l)
+{
+       PROFILE_SCOPED()
+       int button = LuaPull<int>(l, 1);
+       LuaPush(l, ImGui::IsMouseDoubleClicked(button));
+       return 1;
+}
+
 static int l_pigui_push_font(lua_State *l)
 {
        PROFILE_SCOPED()
@@ -2875,6 +2883,7 @@ void LuaObject<PiGui::Instance>::RegisterClass()
                { "PopID", l_pigui_pop_id },
                { "IsMouseReleased", l_pigui_is_mouse_released },
                { "IsMouseClicked", l_pigui_is_mouse_clicked },
+               { "IsMouseDoubleClicked", l_pigui_is_mouse_doubleclicked },
                { "IsMouseDown", l_pigui_is_mouse_down },
                { "IsMouseHoveringRect", l_pigui_is_mouse_hovering_rect },
                { "IsWindowHovered", l_pigui_is_window_hovered },
(END)

@joonicks
Copy link
Contributor Author

that doesnt explain why it DID work in some cases even before it was exposed, a real mystery

@joonicks
Copy link
Contributor Author

hopefully thats the last time this patch needs to be revisited

Copy link
Member

@sturnclaw sturnclaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me, thanks for the many iterations!

@sturnclaw sturnclaw merged commit 4964bfd into pioneerspacesim:master Oct 1, 2021
@joonicks
Copy link
Contributor Author

joonicks commented Oct 1, 2021

Thanks to @zonkmachine too for testing and fixing

@joonicks joonicks deleted the pause-options branch October 6, 2021 17:47
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.

5 participants

X Tutup