|
| 1 | +--[[ |
| 2 | + Copyright (c) Dmitriy. All rights reserved. |
| 3 | + Licensed under the MIT license. See LICENSE file in the project root for details. |
| 4 | +]] |
| 5 | + |
| 6 | +local addonPath = 'Interface\\AddOns\\RetailUI\\' |
| 7 | + |
| 8 | +local UnitFrameAsset = addonPath .. 'Textures\\UI\\UnitFrame.blp' |
| 9 | +local CastingBarAsset = addonPath .. 'Textures\\UI\\CastingBar.blp' |
| 10 | +local CollapseButtonAsset = addonPath .. 'Textures\\UI\\CollapseButton.blp' |
| 11 | +local MinimapAsset = addonPath .. 'Textures\\UI\\Minimap.blp' |
| 12 | +local ActionBarAsset = addonPath .. 'Textures\\UI\\ActionBar.blp' |
| 13 | +local ExperienceBar = addonPath .. 'Textures\\UI\\ExperienceBar.blp' |
| 14 | +local BagSlotsAsset = addonPath .. 'Textures\\UI\\BagSlots.blp' |
| 15 | +local BagSlotsKeyAsset = addonPath .. 'Textures\\UI\\BagSlotsKey.blp' |
| 16 | +local MicroMenuAsset = addonPath .. 'Textures\\UI\\MicroMenu.blp' |
| 17 | + |
| 18 | +local atlasTextures = { |
| 19 | + ['TargetFrame-TextureFrame-Normal'] = { |
| 20 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 423, 633, 0, 89 } |
| 21 | + }, |
| 22 | + ['TargetFrame-TextureFrame-Vehicle'] = { |
| 23 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 636, 846, 91, 181 } |
| 24 | + }, |
| 25 | + ['TargetFrame-TextureFrame-Elite'] = { |
| 26 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 211, 421, 0, 89 } |
| 27 | + }, |
| 28 | + ['TargetFrame-TextureFrame-Rare'] = { |
| 29 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 0, 209, 0, 89 } |
| 30 | + }, |
| 31 | + ['TargetFrame-TextureFrame-RareElite'] = { |
| 32 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 0, 222, 91, 181 } |
| 33 | + }, |
| 34 | + ['TargetFrame-StatusBar-Health'] = { |
| 35 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 3, 128, 459, 481 } |
| 36 | + }, |
| 37 | + ['TargetFrame-StatusBar-Mana'] = { |
| 38 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 130, 264, 459, 471 } |
| 39 | + }, |
| 40 | + ['TargetFrame-Flash'] = { |
| 41 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 0, 209, 275, 365 } |
| 42 | + }, |
| 43 | + ['TargetFrame-HighLevelIcon'] = { |
| 44 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 252, 262, 490, 503 } |
| 45 | + }, |
| 46 | + |
| 47 | + ['PlayerFrame-TextureFrame-Normal'] = { |
| 48 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 423, 633, 91, 181 } |
| 49 | + }, |
| 50 | + ['PlayerFrame-TextureFrame-Vehicle'] = { |
| 51 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 636, 845, 0, 89 } |
| 52 | + }, |
| 53 | + ['PlayerFrame-StatusBar-Health'] = { |
| 54 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 3, 128, 483, 505 } |
| 55 | + }, |
| 56 | + ['PlayerFrame-StatusBar-Mana'] = { |
| 57 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 130, 256, 474, 485 } |
| 58 | + }, |
| 59 | + ['PlayerFrame-Status'] = { |
| 60 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 212, 421, 184, 273 } |
| 61 | + }, |
| 62 | + ['PlayerFrame-Flash'] = { |
| 63 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 0, 209, 184, 273 } |
| 64 | + }, |
| 65 | + ['PlayerFrame-GroupIndicator'] = { |
| 66 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 131, 203, 491, 505 } |
| 67 | + }, |
| 68 | + |
| 69 | + ['PartyFrame-TextureFrame-Normal'] = { |
| 70 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 848, 968, 0, 47 } |
| 71 | + }, |
| 72 | + ['PartyFrame-StatusBar-Health'] = { |
| 73 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 259, 330, 474, 485 } |
| 74 | + }, |
| 75 | + ['PartyFrame-StatusBar-Mana'] = { |
| 76 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 267, 341, 460, 469 } |
| 77 | + }, |
| 78 | + ['PartyFrame-Flash'] = { |
| 79 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 848, 968, 50, 97 } |
| 80 | + }, |
| 81 | + ['PartyFrame-Status'] = { |
| 82 | + asset = { UnitFrameAsset, 1024, 512 }, texcoord = { 848, 968, 184, 147 } |
| 83 | + }, |
| 84 | + |
| 85 | + ['CastingBar-Background'] = { |
| 86 | + asset = { CastingBarAsset, 512, 256 }, texcoord = { 0, 417, 95, 122 } |
| 87 | + }, |
| 88 | + ['CastingBar-Border'] = { |
| 89 | + asset = { CastingBarAsset, 512, 256 }, texcoord = { 0, 423, 63, 90 } |
| 90 | + }, |
| 91 | + ['CastingBar-MainBackground'] = { |
| 92 | + asset = { CastingBarAsset, 512, 256 }, texcoord = { 0, 419, 0, 56 } |
| 93 | + }, |
| 94 | + ['CastingBar-StatusBar-Casting'] = { |
| 95 | + asset = { CastingBarAsset, 512, 256 }, texcoord = { 0, 418, 149, 170 } |
| 96 | + }, |
| 97 | + ['CastingBar-StatusBar-Channeling'] = { |
| 98 | + asset = { CastingBarAsset, 512, 256 }, texcoord = { 0, 417, 124, 146 } |
| 99 | + }, |
| 100 | + ['CastingBar-StatusBar-Failed'] = { |
| 101 | + asset = { CastingBarAsset, 512, 256 }, texcoord = { 0, 417, 173, 196 } |
| 102 | + }, |
| 103 | + ['CastingBar-Spark'] = { |
| 104 | + asset = { CastingBarAsset, 512, 256 }, texcoord = { 423, 430, 97, 150 } |
| 105 | + }, |
| 106 | + ['CastingBar-BorderShield'] = { |
| 107 | + asset = { CastingBarAsset, 512, 256 }, texcoord = { 437, 509, 1, 87 } |
| 108 | + }, |
| 109 | + |
| 110 | + ['CollapseButton-Left'] = { |
| 111 | + asset = { CollapseButtonAsset, 64, 64 }, texcoord = { 4, 22, 0, 31 } |
| 112 | + }, |
| 113 | + ['CollapseButton-Right'] = { |
| 114 | + asset = { CollapseButtonAsset, 64, 64 }, texcoord = { 5, 22, 31, 62 } |
| 115 | + }, |
| 116 | + ['CollapseButton-Up'] = { |
| 117 | + asset = { CollapseButtonAsset, 64, 64 }, texcoord = { 31, 63, 10, 27 } |
| 118 | + }, |
| 119 | + ['CollapseButton-Down'] = { |
| 120 | + asset = { CollapseButtonAsset, 64, 64 }, texcoord = { 31, 62, 37, 54 } |
| 121 | + }, |
| 122 | + |
| 123 | + ['Minimap-Border'] = { |
| 124 | + asset = { MinimapAsset, 512, 1024 }, texcoord = { 1, 431, 63, 498 } |
| 125 | + }, |
| 126 | + ['Minimap-Border-Top'] = { |
| 127 | + asset = { MinimapAsset, 512, 1024 }, texcoord = { 105, 360, 609, 636 } |
| 128 | + }, |
| 129 | + ['Minimap-Mail'] = { |
| 130 | + asset = { MinimapAsset, 512, 1024 }, texcoord = { 42, 81, 520, 550 } |
| 131 | + }, |
| 132 | + ['Minimap-Tracking-Background'] = { |
| 133 | + asset = { MinimapAsset, 512, 1024 }, texcoord = { 441, 480, 402, 440 } |
| 134 | + }, |
| 135 | + ['Minimap-Tracking-Normal'] = { |
| 136 | + asset = { MinimapAsset, 512, 1024 }, texcoord = { 149, 179, 520, 548 } |
| 137 | + }, |
| 138 | + ['Minimap-Tracking-Highlight'] = { |
| 139 | + asset = { MinimapAsset, 512, 1024 }, texcoord = { 117, 147, 520, 548 } |
| 140 | + }, |
| 141 | + ['Minimap-Tracking-Pushed'] = { |
| 142 | + asset = { MinimapAsset, 512, 1024 }, texcoord = { 83, 115, 520, 550 } |
| 143 | + }, |
| 144 | + ['Minimap-ZoomIn-Normal'] = { |
| 145 | + asset = { MinimapAsset, 512, 1024 }, texcoord = { 1, 35, 552, 586 } |
| 146 | + }, |
| 147 | + ['Minimap-ZoomIn-Highlight'] = { |
| 148 | + asset = { MinimapAsset, 512, 1024 }, texcoord = { 1, 35, 624, 658 } |
| 149 | + }, |
| 150 | + ['Minimap-ZoomIn-Pushed'] = { |
| 151 | + asset = { MinimapAsset, 512, 1024 }, texcoord = { 1, 35, 588, 622 } |
| 152 | + }, |
| 153 | + ['Minimap-ZoomOut-Normal'] = { |
| 154 | + asset = { MinimapAsset, 512, 1024 }, texcoord = { 181, 215, 520, 538 } |
| 155 | + }, |
| 156 | + ['Minimap-ZoomOut-Highlight'] = { |
| 157 | + asset = { MinimapAsset, 512, 1024 }, texcoord = { 253, 287, 520, 538 } |
| 158 | + }, |
| 159 | + ['Minimap-ZoomOut-Pushed'] = { |
| 160 | + asset = { MinimapAsset, 512, 1024 }, texcoord = { 217, 251, 520, 538 } |
| 161 | + }, |
| 162 | + |
| 163 | + ['ActionBar-LeftCap-Alliance'] = { |
| 164 | + asset = { ActionBarAsset, 512, 2048 }, texcoord = { 1, 357, 209, 543 } |
| 165 | + }, |
| 166 | + ['ActionBar-RightCap-Alliance'] = { |
| 167 | + asset = { ActionBarAsset, 512, 2048 }, texcoord = { 1, 357, 545, 879 } |
| 168 | + }, |
| 169 | + ['ActionBar-LeftCap-Horde'] = { |
| 170 | + asset = { ActionBarAsset, 512, 2048 }, texcoord = { 1, 357, 881, 1215 } |
| 171 | + }, |
| 172 | + ['ActionBar-RightCap-Horde'] = { |
| 173 | + asset = { ActionBarAsset, 512, 2048 }, texcoord = { 1, 357, 1217, 1551 } |
| 174 | + }, |
| 175 | + ['ActionBar-ButtonUp-Normal'] = { |
| 176 | + asset = { ActionBarAsset, 512, 2048 }, texcoord = { 359, 393, 833, 861 } |
| 177 | + }, |
| 178 | + ['ActionBar-ButtonUp-Highlight'] = { |
| 179 | + asset = { ActionBarAsset, 512, 2048 }, texcoord = { 453, 487, 709, 737 } |
| 180 | + }, |
| 181 | + ['ActionBar-ButtonUp-Pushed'] = { |
| 182 | + asset = { ActionBarAsset, 512, 2048 }, texcoord = { 453, 487, 679, 707 } |
| 183 | + }, |
| 184 | + ['ActionBar-ButtonDown-Normal'] = { |
| 185 | + asset = { ActionBarAsset, 512, 2048 }, texcoord = { 463, 497, 605, 633 } |
| 186 | + }, |
| 187 | + ['ActionBar-ButtonDown-Highlight'] = { |
| 188 | + asset = { ActionBarAsset, 512, 2048 }, texcoord = { 463, 497, 575, 603 } |
| 189 | + }, |
| 190 | + ['ActionBar-ButtonDown-Pushed'] = { |
| 191 | + asset = { ActionBarAsset, 512, 2048 }, texcoord = { 463, 497, 545, 573 } |
| 192 | + }, |
| 193 | + ['ActionBar-ActionButton-Highlight'] = { |
| 194 | + asset = { ActionBarAsset, 512, 2048 }, texcoord = { 359, 451, 1065, 1155 } |
| 195 | + }, |
| 196 | + ['ActionBar-ActionButton-Pushed'] = { |
| 197 | + asset = { ActionBarAsset, 512, 2048 }, texcoord = { 359, 451, 881, 971 } |
| 198 | + }, |
| 199 | + ['ActionBar-ActionButton-Flash'] = { |
| 200 | + asset = { ActionBarAsset, 512, 2048 }, texcoord = { 359, 451, 973, 1063 } |
| 201 | + }, |
| 202 | + ['ActionBar-ActionButton-Border'] = { |
| 203 | + asset = { ActionBarAsset, 512, 2048 }, texcoord = { 359, 451, 649, 739 } |
| 204 | + }, |
| 205 | + ['ActionBar-ActionButton-Background'] = { |
| 206 | + asset = { ActionBarAsset, 512, 2048 }, texcoord = { 359, 487, 209, 333 } |
| 207 | + }, |
| 208 | + |
| 209 | + ['ExperienceBar-Background'] = { |
| 210 | + asset = { ExperienceBar, 2048, 64 }, texcoord = { 0.00088878125, 570, 20, 29 } |
| 211 | + }, |
| 212 | + ['ExperienceBar-Border'] = { |
| 213 | + asset = { ExperienceBar, 2048, 64 }, texcoord = { 1, 572, 1, 18 } |
| 214 | + }, |
| 215 | + |
| 216 | + ['BagsBar-SlotButton-Highlight'] = { |
| 217 | + asset = { BagSlotsAsset, 512, 128 }, texcoord = { 358, 419, 1, 62 } |
| 218 | + }, |
| 219 | + ['BagsBar-SlotButton-Border'] = { |
| 220 | + asset = { BagSlotsAsset, 512, 128 }, texcoord = { 295, 356, 1, 62 } |
| 221 | + }, |
| 222 | + ['BagsBar-KeySlot-Normal'] = { |
| 223 | + asset = { BagSlotsKeyAsset, 128, 128 }, texcoord = { 3, 63, 64, 125 } |
| 224 | + }, |
| 225 | + ['BagsBar-MainSlot-Normal'] = { |
| 226 | + asset = { BagSlotsAsset, 512, 128 }, texcoord = { 1, 97, 1, 97 } |
| 227 | + }, |
| 228 | + ['BagsBar-MainSlot-Highlight'] = { |
| 229 | + asset = { BagSlotsAsset, 512, 128 }, texcoord = { 99, 195, 1, 97 } |
| 230 | + }, |
| 231 | + |
| 232 | + |
| 233 | + ['MicroMenu-Spellbook-Normal'] = { |
| 234 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 389, 440, 312, 382 } |
| 235 | + }, |
| 236 | + ['MicroMenu-Spellbook-Highlight'] = { |
| 237 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 334, 385, 312, 382 } |
| 238 | + }, |
| 239 | + ['MicroMenu-Spellbook-Pushed'] = { |
| 240 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 280, 331, 312, 382 } |
| 241 | + }, |
| 242 | + ['MicroMenu-Talent-Normal'] = { |
| 243 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 170, 221, 312, 382 } |
| 244 | + }, |
| 245 | + ['MicroMenu-Talent-Highlight'] = { |
| 246 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 116, 167, 312, 382 } |
| 247 | + }, |
| 248 | + ['MicroMenu-Talent-Pushed'] = { |
| 249 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 63, 114, 312, 382 } |
| 250 | + }, |
| 251 | + ['MicroMenu-Talent-Disabled'] = { |
| 252 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 6, 57, 312, 382 } |
| 253 | + }, |
| 254 | + ['MicroMenu-LFD-Normal'] = { |
| 255 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 387, 438, 158, 229 } |
| 256 | + }, |
| 257 | + ['MicroMenu-LFD-Highlight'] = { |
| 258 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 331, 382, 158, 229 } |
| 259 | + }, |
| 260 | + ['MicroMenu-LFD-Pushed'] = { |
| 261 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 277, 328, 158, 229 } |
| 262 | + }, |
| 263 | + ['MicroMenu-LFD-Disabled'] = { |
| 264 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 222, 273, 158, 229 } |
| 265 | + }, |
| 266 | + ['MicroMenu-MainMenu-Normal'] = { |
| 267 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 387, 438, 235, 305 } |
| 268 | + }, |
| 269 | + ['MicroMenu-MainMenu-Highlight'] = { |
| 270 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 278, 329, 235, 305 } |
| 271 | + }, |
| 272 | + ['MicroMenu-MainMenu-Pushed'] = { |
| 273 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 333, 383, 235, 305 } |
| 274 | + }, |
| 275 | + ['MicroMenu-Help-Normal'] = { |
| 276 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 169, 219, 158, 228 } |
| 277 | + }, |
| 278 | + ['MicroMenu-Help-Highlight'] = { |
| 279 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 115, 166, 158, 228 } |
| 280 | + }, |
| 281 | + ['MicroMenu-Help-Pushed'] = { |
| 282 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 60, 111, 158, 228 } |
| 283 | + }, |
| 284 | + ['MicroMenu-Socials-Normal'] = { |
| 285 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 169, 220, 235, 305 } |
| 286 | + }, |
| 287 | + ['MicroMenu-Socials-Highlight'] = { |
| 288 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 115, 166, 235, 305 } |
| 289 | + }, |
| 290 | + ['MicroMenu-Socials-Pushed'] = { |
| 291 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 61, 112, 235, 305 } |
| 292 | + }, |
| 293 | + ['MicroMenu-Achievement-Normal'] = { |
| 294 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 383, 433, 4, 74 } |
| 295 | + }, |
| 296 | + ['MicroMenu-Achievement-Highlight'] = { |
| 297 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 329, 380, 4, 74 } |
| 298 | + }, |
| 299 | + ['MicroMenu-Achievement-Pushed'] = { |
| 300 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 274, 325, 4, 74 } |
| 301 | + }, |
| 302 | + ['MicroMenu-Achievement-Disabled'] = { |
| 303 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 220, 271, 4, 74 } |
| 304 | + }, |
| 305 | + ['MicroMenu-QuestLog-Normal'] = { |
| 306 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 166, 217, 4, 74 } |
| 307 | + }, |
| 308 | + ['MicroMenu-QuestLog-Highlight'] = { |
| 309 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 112, 164, 4, 74 } |
| 310 | + }, |
| 311 | + ['MicroMenu-QuestLog-Pushed'] = { |
| 312 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 58, 109, 4, 74 } |
| 313 | + }, |
| 314 | + ['MicroMenu-QuestLog-Disabled'] = { |
| 315 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 4, 55, 4, 74 } |
| 316 | + }, |
| 317 | + ['MicroMenu-Empty'] = { |
| 318 | + asset = { MicroMenuAsset, 512, 512 }, texcoord = { 384, 435, 82, 151 } |
| 319 | + } |
| 320 | +} |
| 321 | + |
| 322 | +function SetAtlasTexture(texture, textureName) |
| 323 | + local atlasInfo = atlasTextures[textureName] |
| 324 | + local assetPath, width, height = unpack(atlasInfo.asset) |
| 325 | + |
| 326 | + local texCoordInfo = atlasInfo.texcoord |
| 327 | + local left, right, top, bottom = unpack(texCoordInfo) |
| 328 | + |
| 329 | + texture:SetTexture(assetPath) |
| 330 | + texture:SetTexCoord(left / width, right / width, top / height, bottom / height) |
| 331 | + texture:SetSize(right - left, bottom - top) |
| 332 | +end |
0 commit comments