TODO: - qrframe1 and qrframe2 variables - a hide qr codes function - the ability to…
- User
TODO:
- qr_frame_1 and qr_frame_2 variables
- a hide qr codes function
- the ability to generate a qr code 1 and a qr code 2 at different places that don't overlap
- maybe top right (qr code 1) and top left (qr code 2)
local BLOCK_SIZE = 3.1
-- Define the width of the border local borderWidth = 2 -- You can adjust this to change the thickness of the border
local qr_frame
local function CreateQRTip(qrsize) if(qr_frame ~= nil) then qr_frame:Hide() end
codeqr_frame = CreateFrame("Frame", nil, UIParent) local function CreateBlock(idx) local t = CreateFrame("Frame", nil, qr_frame) t:SetWidth(BLOCK_SIZE) t:SetHeight(BLOCK_SIZE) t.texture = t:CreateTexture(nil, "OVERLAY") t.texture:SetAllPoints(t) local x = (idx % qrsize) * BLOCK_SIZE local y = (math.floor(idx / qrsize)) * BLOCK_SIZE t:SetPoint("TOPLEFT", qr_frame, 20 + x, - 20 - y); return t end do qr_frame:SetFrameStrata("BACKGROUND") qr_frame:SetWidth(qrsize * BLOCK_SIZE + 40) qr_frame:SetHeight(qrsize * BLOCK_SIZE + 40) qr_frame:SetMovable(true) qr_frame:EnableMouse(true) qr_frame:SetPoint("CENTER", 0, 0) qr_frame:RegisterForDrag("LeftButton") qr_frame:SetScript("OnDragStart", function(self) self:StartMoving() end) qr_frame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end) end do local b = CreateFrame("Button", nil, qr_frame, "UIPanelCloseButton") b:SetPoint("TOPRIGHT", qr_frame, 0, 0); end qr_frame.boxes = {} qr_frame.SetBlack = function(idx) qr_frame.boxes[idx].texture:SetColorTexture(0, 0, 0) end qr_frame.SetWhite = function(idx) qr_frame.boxes[idx].texture:SetColorTexture(1, 1, 1) end -- Create the blocks with an additional border for i = 1, (qrsize + 2 * borderWidth) * (qrsize + 2 * borderWidth) do tinsert(qr_frame.boxes, CreateBlock(i - 1)) end return qr_frame - Assistant
To complete your TODO list, I'm going to add enhancements to your Lua script to achieve the following:
- Creation of two separate QR code frames (
qr_frame_1andqr_frame_2). - A function to hide both QR code frames.
- The ability to generate
qr_frame_1andqr_frame_2in the top right and top left of the screen, respectively, without overlap.
Let's start by adjusting the function to accept an identifier for which QR code frame to create (1 or 2), and position them at the top right and top left:
- Creation of two separate QR code frames (