18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-20 22:04:59 +01:00

feat(editor): the cursor drawn into the picture, for streams and recordings of the window

View > Cursor drawn into the picture (streams): the system pointer is hidden and ImGui draws its own into the frame, so it shows
in a capture of the window (Discord, OBS, the capture of the system), which leaves the system pointer out. Off by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
This commit is contained in:
Claude
2026-11-09 23:14:12 +01:00
parent e6fa206e47
commit be7f9e4712
4 changed files with 26 additions and 1 deletions

View File

@@ -4186,6 +4186,11 @@ void editor_mode::render_view_menu()
ImGui::MenuItem(STR_C("Show lanes"), nullptr, &m_roadtool.lanes); ImGui::MenuItem(STR_C("Show lanes"), nullptr, &m_roadtool.lanes);
if (ImGui::IsItemHovered()) if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s", STR_C("The lanes of the roads drawn as the paths the vehicles take")); ImGui::SetTooltip("%s", STR_C("The lanes of the roads drawn as the paths the vehicles take"));
if (ImGui::MenuItem(STR_C("Cursor drawn into the picture (streams)"), nullptr, ui_layer::drawn_cursor()))
ui_layer::draw_cursor(false == ui_layer::drawn_cursor());
if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s", STR_C("The pointer drawn by the editor into the frame instead of the one of the system: seen by those watching a stream\n"
"or a recording of the window (Discord, OBS, the capture of the system), which leave the system pointer out"));
if (ImGui::MenuItem(STR_C("Structure gauge"), nullptr, m_gauge.is_open())) if (ImGui::MenuItem(STR_C("Structure gauge"), nullptr, m_gauge.is_open()))
m_gauge.toggle(); m_gauge.toggle();
if (ImGui::IsItemHovered()) if (ImGui::IsItemHovered())

View File

@@ -624,8 +624,18 @@ void ui_layer::render_hierarchy(){
void ui_layer::set_cursor(int const Mode) void ui_layer::set_cursor(int const Mode)
{ {
glfwSetInputMode(m_window, GLFW_CURSOR, Mode); // the cursor drawn into the picture: the one of the system hidden, so only that one shows, also in a capture of the window
auto const hidden{Mode == GLFW_CURSOR_NORMAL && m_drawcursor};
glfwSetInputMode(m_window, GLFW_CURSOR, hidden ? GLFW_CURSOR_HIDDEN : Mode);
m_cursorvisible = Mode != GLFW_CURSOR_DISABLED; m_cursorvisible = Mode != GLFW_CURSOR_DISABLED;
if (m_imguiio != nullptr)
m_imguiio->MouseDrawCursor = m_drawcursor && m_cursorvisible;
}
void ui_layer::draw_cursor(bool const Draw)
{
m_drawcursor = Draw;
set_cursor(m_cursorvisible ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_DISABLED);
} }
void ui_layer::set_progress(std::string const &Text) void ui_layer::set_progress(std::string const &Text)

View File

@@ -104,6 +104,9 @@ public:
static void begin_ui_frame_internal(); static void begin_ui_frame_internal();
// //
static void set_cursor( int Mode ); static void set_cursor( int Mode );
// the cursor drawn into the picture by the interface instead of the system: seen in a stream or a recording of the window
static void draw_cursor( bool Draw );
static bool drawn_cursor() { return m_drawcursor; }
// loading // loading
void set_progress(std::string const &Text); void set_progress(std::string const &Text);
void set_progress(float progress, float subtaskprogress); void set_progress(float progress, float subtaskprogress);
@@ -139,6 +142,7 @@ protected:
static GLFWwindow *m_keywindow; // window of the key event being handled static GLFWwindow *m_keywindow; // window of the key event being handled
static ImGuiIO *m_imguiio; static ImGuiIO *m_imguiio;
static bool m_cursorvisible; static bool m_cursorvisible;
static inline bool m_drawcursor{ false };
virtual void render_menu_contents(); virtual void render_menu_contents();
// items of the windows menu which belong to the ui of a mode, after the common ones // items of the windows menu which belong to the ui of a mode, after the common ones

View File

@@ -14207,3 +14207,9 @@ msgstr "W czasie jazdy: W i S to jazda naprzód i wstecz, z Shift szybciej; A i
msgid "Ride along a track with Y" msgid "Ride along a track with Y"
msgstr "Przejedź się po torze klawiszem Y" msgstr "Przejedź się po torze klawiszem Y"
msgid "Cursor drawn into the picture (streams)"
msgstr "Kursor rysowany w obrazie (stream)"
msgid "The pointer drawn by the editor into the frame instead of the one of the system: seen by those watching a stream\nor a recording of the window (Discord, OBS, the capture of the system), which leave the system pointer out"
msgstr "Wskaźnik rysowany przez edytor w klatce zamiast systemowego: widać go w streamie\ni w nagraniu okna (Discord, OBS, przechwytywanie systemowe), które pomijają wskaźnik systemu"