|Go to Page...|
MyMinimapButton is an embedded library to make creating and managing minimap buttons easy for mod authors.
By embedded library, it's one single lua file (MyMinimapButton.lua) that you toss into your addon's folder and use without dependencies or worrying about other mods using the same library.
Any number of mods can include this file, older or newer versions. Multiple copies aren't made, it just uses the most recent version. Every attempt will be made to keep it backwards compatable from this point forward.
To demonstrate MyMinimapButton's use, this download includes a mod called MyMinimapButton-Demo. This demo adds a 'Minimap' button to the macro edit window. When you select a macro and click the button, it creates a minimap button that will attempt to run the macro when clicked. (It can only run macros entirely in /script form -- it doesn't include a parser for slash commands)
Also included in the download is a zip file named TestMod that demonstrates different ways of creating buttons.
1. Toss MyMinimapButton.lua into your addon's folder
2. Include the file in your .toc
3. Use the API to create and manipulate the button.
An example of use:
MyMinimapButton:Create("MyMod",MyMod_Settings) MyMinimapButton:SetIcon("MyMod","Interface\\AddOns\\MyMod\\MyIcon") MyMinimapButton:SetLeftClick("MyMod",MyMod_MinimapButton_OnClick)