#include "ui/ui_extensions.lua" #include "ui/components/buttons.lua" Ui.Button = Teardown.GenericButton hideHud = false trigCapture = false ScreenRecorder = Ui.Window { fitToContent = true, animator = { playTime = 0.25 }; onPreDraw = function(self) self.x = UiCenter() - self.w / 2; self.y = UiMiddle() - self.h / 2; end; onClose = function(self) if trigCapture then Command("game.screenrecord", hideHud) trigCapture = false end end, Ui.ImageBox { id = "bg", border = { width = 10, height = 10, }; path = "ui/common/box-solid-10.png", color = {0,0,0,0.7}, }; Ui.Frame { onCreate = function(self) self.content = self:findById("content") end; onPreDraw = function(self) self.w = self.content.w + 60 self.h = self.content.h + 60 local bg = self.root.bg bg.w = self.w bg.h = self.h end; Ui.VerticalLayout { id = "content", hAlign = Ui.ContentLayout.Horizontal.Center; vAlign = Ui.ContentLayout.Vertical.Middle; alignment = Ui.ContentLayout.Horizontal.Center; Ui.VerticalLayout { alignment = Ui.ContentLayout.Horizontal.Center; title = Ui.Text { text = "loc@UI_TEXT_SCREEN_RECORDER"; font = {"bold.ttf", 27}; }; info = Ui.Text { text = "loc@UI_TEXT_SCREEN_RECORDER_2"; font = {"regular.ttf", 23 / 1.23}; color = 0xE6E6E6FF; wrapWidth = 440; margin = { top = 10 }; }; }; Ui.HorizontalLayout { alignment = Ui.ContentLayout.Horizontal.Center; padding = 20; margin = { top = 10 }; Ui.Text { text = "loc@UI_TEXT_CAPTURE_UI"; font = {"regular.ttf", 22 / 1.23}; }; Ui.Button { text = "loc@UI_BUTTON_DISABLED"; font = {"regular.ttf", 22/1.23}; textColor = {1,1,0.5}; textOnly = true; onPreDraw = function(self) if hideHud then self.text = "loc@UI_BUTTON_DISABLED" else self.text = "loc@UI_BUTTON_ENABLED" end end; onReleased = function(self) hideHud = not hideHud end; }; }; Ui.HorizontalLayout { alignment = Ui.ContentLayout.Horizontal.Center; padding = 20; margin = { top = 20 }; Ui.Button { text = "loc@UI_BUTTON_CANCEL"; w = 150; h = 36; font = {"regular.ttf", 26/1.23}; imageBox = {"ui/common/box-outline-6.png", 6, 6, 1, 1, 1, 0.8}; textColor = {1,1,1}; textHoverColor = {1,1,1}; hoveredImageBox = nil; onPressed = function(self) self.root:hide() end; }; Ui.Button { text = "loc@UI_BUTTON_RECORD"; w = 150; h = 36; font = {"regular.ttf", 26/1.23}; imageBox = {"ui/common/box-outline-6.png", 6, 6, 1, 1, 1, 0.8}; fillColor = {1, 0.3, 0.3, 0.2}; textColor = {1,1,1}; textHoverColor = {1,1,1}; hoveredImageBox = nil; onPressed = function(self) trigCapture = true self.root:hide() end; }; }; }; }; } function tick(dt) if PauseMenuButton("loc@SCREEN_RECORDER") then ScreenRecorder:show(); end end function draw() end