diff --git a/lua/gmod_integration/client/cl_context_menu.lua b/lua/gmod_integration/client/cl_context_menu.lua index 40241be..ae7ea02 100644 --- a/lua/gmod_integration/client/cl_context_menu.lua +++ b/lua/gmod_integration/client/cl_context_menu.lua @@ -22,4 +22,16 @@ list.Set("DesktopWindows", "GmodIntegration:DesktopWindows:ReportBug", { window:Close() gmInte.openReportBug() end +}) + +list.Set("DesktopWindows", "GmodIntegration:DesktopWindows:SendScreen", { + icon = "gmod_integration/logo_context_screen.png", + title = "Dsc Screen", + width = 960, + height = 700, + onewindow = true, + init = function(icon, window) + window:Close() + gmInte.contextScreenshot() + end }) \ No newline at end of file diff --git a/lua/gmod_integration/client/cl_screenshots.lua b/lua/gmod_integration/client/cl_screenshots.lua index c90a37d..a767b64 100644 --- a/lua/gmod_integration/client/cl_screenshots.lua +++ b/lua/gmod_integration/client/cl_screenshots.lua @@ -57,4 +57,36 @@ hook.Add("OnPlayerChat", "gmInteChatCommands", function(ply, text, teamChat, isD gmInte.takeScreenShot() return true end -end) \ No newline at end of file +end) + +local contextMenuOpen = false +local contextClick = false +hook.Add("OnContextMenuOpen", "gmInte:ContextScreen:ContextMenu:Open", function() contextMenuOpen = true end) +hook.Add("OnContextMenuClose", "gmInte:ContextScreen:ContextMenu:Close", function() contextMenuOpen = false end) +hook.Add("HUDPaint", "gmInte:ContextScreen:Screenshot", function() + if !contextClick then return end + if !contextMenuOpen then return end + surface.SetDrawColor(230, 230, 230) + surface.DrawRect(0, 0, ScrW(), 3) + surface.DrawRect(0, 0, 3, ScrH()) + surface.DrawRect(ScrW() - 3, 0, 3, ScrH()) + surface.DrawRect(0, ScrH() - 3, ScrW(), 3) + surface.DrawRect(ScrW() / 2 - 10, ScrH() / 2 - 1, 20, 2) + surface.DrawRect(ScrW() / 2 - 1, ScrH() / 2 - 10, 2, 20) + surface.SetDrawColor(0, 0, 0, 50) + surface.DrawRect(0, 0, ScrW(), ScrH()) + draw.SimpleText(gmInte.getTranslation("report_bug.context_menu.screen_capture", "Close the context menu to take the screenshot that will be send to Discord."), "Trebuchet24", ScrW() / 2, ScrH() / 2 + 40, Color(255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) +end) + +function gmInte.contextScreenshot() + if ScreenshotRequested then return end + contextClick = true + local timerName = "gmInte:ContextScreen:Screenshot:Open" + gmInte.showScreenshotInfo = true + timer.Create(timerName, 0.2, 0, function() + if contextMenuOpen then return end + contextClick = false + timer.Remove(timerName) + timer.Simple(0.5, gmInte.takeScreenShot) + end) +end \ No newline at end of file diff --git a/materials/gmod_integration/logo_context_screen.png b/materials/gmod_integration/logo_context_screen.png new file mode 100644 index 0000000..9b22917 Binary files /dev/null and b/materials/gmod_integration/logo_context_screen.png differ