Thread Tools Display Modes
08-03-10, 12:33 PM   #1
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Post Minimap Shape help

Hi there all. I wanted to update my addon so you can do a command to change the shape.

this is what I have so far. I don't get any errors but when I do /wm round or /wm square my textures over lap the other.

so when you log in i have it set like this

Code:
function GetMinimapShape() return 'SQUARE' end
        local s = m:CreateTexture(nil,"square")
	s:SetTexture("Interface\\AddOns\\wMmap\\texture\\square")
	s:SetPoint("TOPLEFT", m, "TOPLEFT", -12, 12)
	s:SetPoint("BOTTOMRIGHT", m, "BOTTOMRIGHT", 12, -12)
	s:SetBlendMode("BLEND")

then when you want to change the shape I added this code

Code:
local function SHAPE(msg)
	local msg = strlower(msg)
	
	if msg == "square" then
		m:SetMaskTexture("Interface\\AddOns\\wMmap\\texture\\Mask.blp")
		function GetMinimapShape() return "SQUARE" end
        local s = m:CreateTexture(nil,"square")
	s:SetTexture("Interface\\AddOns\\wMmap\\texture\\square")
	s:SetPoint("TOPLEFT", m, "TOPLEFT", -12, 12)
	s:SetPoint("BOTTOMRIGHT", m, "BOTTOMRIGHT", 12, -12)
	s:SetBlendMode("BLEND")
		print(wname.."|cFF00FFFF: Set to Square.|r")
	elseif msg == "round" then
		Minimap:SetMaskTexture("Interface\\AddOns\\wMmap\\texture\\Mask-ROUND")
		function GetMinimapShape() return "ROUND" end
        local r = m:CreateTexture(nil,"round")
	r:SetTexture("Interface\\AddOns\\wMmap\\texture\\round")
	r:SetPoint("TOPLEFT", m, "TOPLEFT", -12, 12)
	r:SetPoint("BOTTOMRIGHT", m, "BOTTOMRIGHT", 12, -12)
	r:SetBlendMode("BLEND")
		print(wname.."|cFF00FFFF: Set to Round.|cFF00FFFF")
	else
		print(wname.."|cFF00FFFF: Type /shape round or square to change the shape|cFF00FFFF")
	end
end

SLASH_SHAPE1 = "/shape"
SlashCmdList["SHAPE"] = SHAPE
an image to see




thanks for your time

Last edited by weasoug : 08-03-10 at 12:48 PM.
  Reply With Quote
08-03-10, 03:22 PM   #2
Guardix
A Cyclonian
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 42
I think changing mask texture requires a reloaded UI.
__________________
  Reply With Quote
08-03-10, 03:26 PM   #3
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Originally Posted by Guardix View Post
I think changing mask texture requires a reloaded UI.


i guess your right, as i have tryed a few things.
  Reply With Quote
08-03-10, 03:27 PM   #4
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
I thought it even requires a logout rather than reload UI. Not sure though.
  Reply With Quote
08-03-10, 04:07 PM   #5
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Originally Posted by Haleth View Post
I thought it even requires a logout rather than reload UI. Not sure though.
wel this is what my minimap addon uses.

if minimapshape == "round" then
function GetMinimapShape() return "ROUND" end
m:SetMaskTexture("Interface\\AddOns\\wMmap\\texture\\Mask-ROUND")

local r = m:CreateTexture(nil,"round")
r:SetTexture("Interface\\AddOns\\wMmap\\texture\\round")
r:SetPoint("TOPLEFT", m, "TOPLEFT", -12, 12)
r:SetPoint("BOTTOMRIGHT", m, "BOTTOMRIGHT", 12, -12)
r:SetBlendMode("BLEND")
but like said it needs a reload to change.

as i have

local minimapshape = "round"
and to change the round to the shape you want. and then you can reload. but i felt i could add this into a command.
  Reply With Quote
08-03-10, 04:26 PM   #6
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
I tried this with MidgetMap and did the same thing and thought it wasn't going to work, so I just got rid of my skins, and made it a plain minimap instead so the shape call command ingame would be possible, using your own textures :P
  Reply With Quote
08-03-10, 05:59 PM   #7
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Your problem is that each time you change the shape of the minimap you are creating a new texture and slapping it over what was there before. You need to create one texture and reuse it to avoid your problem (and just for good programming).

Also, I can't figure out why you are creating the GetMinimapShape function. You don't use it in your code at all. I have seen a couple different people post something similar and all I can think of it is for compatibility with another addon or everyone is just basing their code off the same bad example. If that function really is needed I would suggest using an internal variable to keep track of the shape (should be saving it anyway) and create the function once and have it just return that setting.

To fix your problem quickly based on what you posted:
Code:
local t = m:CreateTexture(nil, 'ARTWORK')
t:SetPoint('TOPLEFT', m, 'TOPLEFT', -12, 12)
t:SetPoint('BOTTOMRIGHT', m, 'BOTTOMRIGHT', 12, -12)
t:SetBlendMode('BLEND')

local function SHAPE(msg)
	msg = msg:lower()
	if msg == "square" then
		m:SetMaskTexture([[Interface\AddOns\wMmap\texture\Mask]])
		t:SetTexture([[Interface\AddOns\wMmap\texture\square]])
		print(wname.."|cFF00FFFF: Shape set to square.|r")
	elseif msg == "round" then
		m:SetMaskTexture([[Interface\AddOns\wMmap\texture\Mask-ROUND]])
		t:SetTexture([[Interface\AddOns\wMmap\texture\round]])
		print(wname.."|cFF00FFFF: Shape set to round.|r")
	else
		print(wname.."|cFF00FFFF: Type /shape round or square to change the shape.|r")
	end
end

SLASH_SHAPE1 = "/shape"
SlashCmdList["SHAPE"] = SHAPE

You could also rename the texture files you are using to simplify it even more:
Code:
local t = m:CreateTexture(nil, 'ARTWORK')
t:SetPoint('TOPLEFT', m, 'TOPLEFT', -12, 12)
t:SetPoint('BOTTOMRIGHT', m, 'BOTTOMRIGHT', 12, -12)
t:SetBlendMode('BLEND')

local function SHAPE(msg)
	msg = msg:lower()
	if msg == "round" or msg == "square" then
		m:SetMaskTexture([[Interface\AddOns\wMmap\texture\mask-]] .. msg)
		t:SetTexture([[Interface\AddOns\wMmap\texture\]] .. msg)
		print(wname.."|cFF00FFFF: Shape set to " .. msg .. ".|r")
	else
		print(wname.."|cFF00FFFF: Type /shape round or square to change the shape.|r")
	end
end

SLASH_SHAPE1 = "/shape"
SlashCmdList["SHAPE"] = SHAPE
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Minimap Shape help


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off