Skip to content

Instantly share code, notes, and snippets.

@Meorawr
Meorawr / BidirectionalScrollTemplate.lua
Last active August 2, 2023 22:28
Bidirectional Scroll Frame
local ScrollChild = CreateFrame("Frame")
ScrollChild:SetSize(750, 750)
local ScrollChildTexture = ScrollChild:CreateTexture()
ScrollChildTexture:SetPoint("CENTER")
ScrollChildTexture:SetTexture([[Interface\ICONS\TEMP]])
local ScrollFrame = CreateFrame("ScrollFrame")
ScrollFrame:SetPoint("CENTER")
ScrollFrame:SetSize(500, 500)
@Meorawr
Meorawr / InterpolatedScrollDemo.lua
Created July 18, 2023 20:34
Interpolated Scroll Demo
local ScrollBox = CreateFrame("Frame", nil, UIParent, "WowScrollBox")
ScrollBox:SetPoint("CENTER")
ScrollBox:SetSize(300, 300)
ScrollBox:SetInterpolateScroll(true)
local ScrollBar = CreateFrame("EventFrame", nil, UIParent, "MinimalScrollBar")
ScrollBar:SetPoint("TOPLEFT", ScrollBox, "TOPRIGHT")
ScrollBar:SetPoint("BOTTOMLEFT", ScrollBox, "BOTTOMRIGHT")
ScrollBar:SetInterpolateScroll(true)
@Meorawr
Meorawr / EmoteWheel.lua
Last active July 15, 2023 14:38
Radial Wheel Experiment
LoadAddOn("Blizzard_RadialWheel")
local EmoteWedges =
{
{
type = "ROAR",
icon = "Ping_Wheel_Icon_OnMyWay",
text = "Test Wedge 1",
},
{
@Meorawr
Meorawr / DependentCheckBoxSetting.lua
Created June 26, 2023 22:45
Vertical Layout Dependent Checkbox Setting
local SettingsCategory = Settings.RegisterVerticalLayoutCategory("My AddOn")
local ParentSetting;
local ParentInitializer;
local function IsParentSelected()
return ParentSetting:GetValue()
end
do
@Meorawr
Meorawr / PrivateAuras_AuraAnchorExample.lua
Created March 31, 2023 20:59
Private Auras API Examples
-- This example will configure an anchor to display the first private aura that
-- gets applied to the player.
--
-- Multiple calls for the same aura index can be made. This will in effect
-- create multiple distinct displays for the same aura index.
local AuraFrame1 = CreateFrame("Frame", UIParent);
AuraFrame1:SetPoint("CENTER");
AuraFrame1:SetSize(48, 48);
@Meorawr
Meorawr / MyAddon_TabSystemDemoFrame.lua
Last active December 12, 2022 15:37
Tab System Demo
MyAddon_TabSystemDemoFrameMixin = {}
function MyAddon_TabSystemDemoFrameMixin:OnLoad()
TabSystemOwnerMixin.OnLoad(self)
self:SetTabSystem(self.TabSystem)
self.tabIndexPage1 = self:AddNamedTab("Page 1", self.TabPage1)
self.tabIndexPage2 = self:AddNamedTab("Page 2 (with truncated text)", self.TabPage2)
self.tabIndexPage3 = self:AddNamedTab("Page 3", self.TabPage3)
self:SetTab(self.tabIndexPage2)
end
@Meorawr
Meorawr / ContinueOnTextureLoad.lua
Created July 7, 2022 13:19
Texture Load Watcher
local TextureParent = CreateFrame("Frame")
TextureParent:SetPoint("BOTTOMRIGHT", nil, "TOPLEFT")
TextureParent:SetSize(1, 1)
local TexturePool = CreateTexturePool(TextureParent)
local WatcherPool = CreateFramePool("Frame", TextureParent)
function ContinueOnTextureLoad(path, callback)
local texture = TexturePool:Acquire()
local watcher
@Meorawr
Meorawr / ScrollableTreeFrame.lua
Created June 11, 2022 16:35
Scrollable Tree Frame Demo
ScrollableTreeFrameMixin = {};
function ScrollableTreeFrameMixin:OnLoad()
self.DataProvider = CreateTreeListDataProvider();
for i = 1, 10 do
-- The data supplied to the insert calls is arbitrary; it can be accessed
-- from the 'node:GetData()' call later in the element initializer.
local level1 = self.DataProvider:Insert(format("Node %d", i));
for j = 1, fastrandom(3, 6) do
@Meorawr
Meorawr / Generate-Atlases.ps1
Last active September 6, 2022 14:32
TextureAtlasViewer Atlas Compiler
#Requires -Version 7.1
<#
.SYNOPSIS
Generates an output document of atlases pulled from WoW client databases
suitable for use with the Texture Atlas Viewer addon.
#>
[CmdletBinding()]
param (
# Client version to generate atlases for, eg. "9.2.0.42069".
@Meorawr
Meorawr / RotatedFontString.lua
Last active January 12, 2022 13:41
Rotated FontString
local Button = CreateFrame("Button", nil, UIParent, "UIPanelButtonTemplate");
Button:SetPoint("CENTER");
Button:SetText("Resistances");
local ButtonFontString = Button:GetFontString();
ButtonFontString:ClearAllPoints();
ButtonFontString:SetPoint("CENTER", -5, -10);
-- FontStrings can't be rotated like textures, but you can fake it with
-- an animation that either infinitely repeats or just never ends.