mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-17 01:47:35 +00:00
Fix: language of the cl_report_bug
This commit is contained in:
parent
34d22baab9
commit
f361bd884a
|
@ -1,3 +1,45 @@
|
||||||
|
local ScreenshotRequested = false
|
||||||
|
local contextMenuOpen = false
|
||||||
|
hook.Add("OnContextMenuOpen", "gmInte:BugReport:ContextMenu:Open", function() contextMenuOpen = true end)
|
||||||
|
hook.Add("OnContextMenuClose", "gmInte:BugReport:ContextMenu:Close", function() contextMenuOpen = false end)
|
||||||
|
hook.Add("HUDPaint", "gmInte:BugReport:Screenshot", function()
|
||||||
|
if !ScreenshotRequested 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 to use in the bug report."), "Trebuchet24", ScrW() / 2, ScrH() / 2 + 40, Color(255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
|
||||||
|
end)
|
||||||
|
|
||||||
|
local screenCapture = nil
|
||||||
|
local screenFileID = nil
|
||||||
|
local captureData = nil
|
||||||
|
hook.Add("PostRender", "gmInte:BugReport:Screenshot", function()
|
||||||
|
if !ScreenshotRequested then return end
|
||||||
|
if contextMenuOpen then return end
|
||||||
|
captureData = {
|
||||||
|
format = "jpeg",
|
||||||
|
x = 0,
|
||||||
|
y = 0,
|
||||||
|
w = ScrW(),
|
||||||
|
h = ScrH(),
|
||||||
|
quality = 95,
|
||||||
|
}
|
||||||
|
|
||||||
|
screenCapture = render.Capture(captureData)
|
||||||
|
ScreenshotRequested = false
|
||||||
|
gmInte.showScreenshotInfo = false
|
||||||
|
if !file.Exists("gmod_integration/report_bug", "DATA") then file.CreateDir("gmod_integration/report_bug") end
|
||||||
|
if screenCapture then file.Write("gmod_integration/report_bug/" .. screenFileID .. ".jpeg", screenCapture) end
|
||||||
|
end)
|
||||||
|
|
||||||
|
local function openReportBug()
|
||||||
local Fields = {
|
local Fields = {
|
||||||
{
|
{
|
||||||
["title"] = gmInte.getTranslation("report_bug.screenshot", "Screenshot"),
|
["title"] = gmInte.getTranslation("report_bug.screenshot", "Screenshot"),
|
||||||
|
@ -55,48 +97,6 @@ local Fields = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local ScreenshotRequested = false
|
|
||||||
local contextMenuOpen = false
|
|
||||||
hook.Add("OnContextMenuOpen", "gmInte:BugReport:ContextMenu:Open", function() contextMenuOpen = true end)
|
|
||||||
hook.Add("OnContextMenuClose", "gmInte:BugReport:ContextMenu:Close", function() contextMenuOpen = false end)
|
|
||||||
hook.Add("HUDPaint", "gmInte:BugReport:Screenshot", function()
|
|
||||||
if !ScreenshotRequested 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 to use in the bug report."), "Trebuchet24", ScrW() / 2, ScrH() / 2 + 40, Color(255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
|
|
||||||
end)
|
|
||||||
|
|
||||||
local screenCapture = nil
|
|
||||||
local screenFileID = nil
|
|
||||||
local captureData = nil
|
|
||||||
hook.Add("PostRender", "gmInte:BugReport:Screenshot", function()
|
|
||||||
if !ScreenshotRequested then return end
|
|
||||||
if contextMenuOpen then return end
|
|
||||||
captureData = {
|
|
||||||
format = "jpeg",
|
|
||||||
x = 0,
|
|
||||||
y = 0,
|
|
||||||
w = ScrW(),
|
|
||||||
h = ScrH(),
|
|
||||||
quality = 95,
|
|
||||||
}
|
|
||||||
|
|
||||||
screenCapture = render.Capture(captureData)
|
|
||||||
ScreenshotRequested = false
|
|
||||||
gmInte.showScreenshotInfo = false
|
|
||||||
if !file.Exists("gmod_integration/report_bug", "DATA") then file.CreateDir("gmod_integration/report_bug") end
|
|
||||||
if screenCapture then file.Write("gmod_integration/report_bug/" .. screenFileID .. ".jpeg", screenCapture) end
|
|
||||||
end)
|
|
||||||
|
|
||||||
local function openReportBug()
|
|
||||||
local frame = vgui.Create("DFrame")
|
local frame = vgui.Create("DFrame")
|
||||||
frame:SetSize(500, (700 / 1080) * ScrH())
|
frame:SetSize(500, (700 / 1080) * ScrH())
|
||||||
frame:Center()
|
frame:Center()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user