Thread Tools Display Modes
10-20-13, 09:24 PM   #1
Jonisaurus
An Aku'mai Servant
 
Jonisaurus's Avatar
Join Date: Aug 2011
Posts: 35
Minimalistic Text oUF

I don't have much programming ability and can't really figure this out myself...

I need some oUF code to make a super minimalistic player and target frame. It should not consist of any bars or pictures, only the following in that order and arrangement:


playerHP%, playerPower% ----- targetHP%, targetPower%
playerName, playerLevel ------- targetLevel, targetName


With distinct colours for HP, level, different power types, class.

That's it. I would be immensely grateful if you could help. I don't know how to to do this properly.

It would be nice to simply inject this into another small oUF layout lua file I already have to combine the two (the one I have has 0 font/text at the moment).

Thanks for the help!
  Reply With Quote
10-21-13, 03:23 AM   #2
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
First set yourself up some color functions that you can use in tags later on.

Color functions
Lua Code:
  1. --------------------------------------
  2. --VARIABLES
  3. --------------------------------------
  4.  
  5. local PowerBarColor = PowerBarColor
  6. local RAID_CLASS_COLORS = RAID_CLASS_COLORS
  7. local FACTION_BAR_COLORS = FACTION_BAR_COLORS
  8. local abs, floor, format = abs, floor, format
  9.  
  10. --------------------------------------
  11. --COLOR LIB
  12. --------------------------------------
  13.  
  14. --gradient color lib
  15. local CS = CreateFrame("ColorSelect")
  16.  
  17. --get HSV from RGB color
  18. function CS:GetHSVColor(color)
  19.   self:SetColorRGB(color.r, color.g, color.b)
  20.   local h,s,v = self:GetColorHSV()
  21.   return {h=h,s=s,v=v}
  22. end
  23.  
  24. --get RGB from HSV color
  25. function CS:GetRGBColor(color)
  26.   self:SetColorHSV(color.h, color.s, color.v)
  27.   local r,g,b = self:GetColorRGB()
  28.   return {r=r,g=g,b=b}
  29. end
  30.  
  31. --input two HSV colors and a percentage
  32. --returns new HSV color
  33. function CS:GetSmudgeColorHSV(colorA,colorB,percentage)
  34.   local colorC = {}
  35.   --check if the angle between the two H values is > 180
  36.   if abs(colorA.h-colorB.h) > 180 then
  37.     local angle = (360-abs(colorA.h-colorB.h))*percentage
  38.     if colorA.h < colorB.h then
  39.       colorC.h = floor(colorA.h-angle)
  40.       if colorC.h < 0 then
  41.         colorC.h = 360+colorC.h
  42.       end
  43.     else
  44.       colorC.h = floor(colorA.h+angle)
  45.       if colorC.h > 360 then
  46.         colorC.h = colorC.h-360
  47.       end
  48.     end
  49.   else
  50.     colorC.h = floor(colorA.h-(colorA.h-colorB.h)*percentage)
  51.   end    
  52.   colorC.s = colorA.s-(colorA.s-colorB.s)*percentage
  53.   colorC.v = colorA.v-(colorA.v-colorB.v)*percentage
  54.   return colorC
  55. end
  56.  
  57. local redColor = CS:GetHSVColor({r=1,g=0,b=0})
  58. local greenColor = CS:GetHSVColor({r=0,g=1,b=0})
  59.  
  60. --------------------------------------
  61. --GET RGB as HEX-Color
  62. --------------------------------------
  63.  
  64. local function GetHexColor(color)
  65.   return format("%02x%02x%02x", color.r*255, color.g*255, color.b*255)
  66. end
  67.  
  68. --------------------------------------
  69. --COLOR FUNCTIONS
  70. --------------------------------------
  71.  
  72. --GetPowerTypeColor func
  73. local function GetPowerTypeColor(unit)
  74.   if not unit then return end
  75.   local id, power, r, g, b = UnitPowerType(unit)
  76.   local color = PowerBarColor[power]
  77.   if color then
  78.     r, g, b = color.r, color.g, color.b
  79.   end
  80.   return {r=r,g=g,b=b}
  81. end
  82.  
  83. --GetLevelColor func
  84. local function GetLevelColor(unit)
  85.   if not unit then return end
  86.   return GetQuestDifficultyColor(unit)
  87. end
  88.  
  89. --GetUnitColor func
  90. local function GetUnitColor(unit)
  91.   if not unit then return end
  92.   local color
  93.   if UnitIsDeadOrGhost(unit) or not UnitIsConnected(unit) then
  94.     color = {r = 0.5, g = 0.5, b = 0.5}
  95.   elseif UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) then
  96.     color = {r = 0.5, g = 0.5, b = 0.5}
  97.   elseif UnitIsPlayer(unit) then
  98.     color = RAID_CLASS_COLORS[select(2, UnitClass(unit))]
  99.   else
  100.     color = FACTION_BAR_COLORS[UnitReaction(unit, "player")]
  101.   end
  102.   return color
  103. end
  104.  
  105. --GetHealthColor func  
  106. local function GetHealthColor(unit)
  107.   if not unit then return end
  108.   local hcur, hmax = UnitHealth(unit), UnitHealthMax(unit)
  109.   local hper = 0
  110.   if hmax > 0 then hper = hcur/hmax end
  111.   --you may need to swap red and green color
  112.   return CS:GetRGBColor(CS:GetSmudgeColorHSV(redColor,greenColor,hper))
  113. end

After that you set up 4 tags for UnitLevel, UnitName, UnitPower and UnitHealth coloring.

Lua Code:
  1. --------------------------------------
  2. --TAGS
  3. --------------------------------------
  4.  
  5. --unit name tag
  6. oUF.Tags.Methods["unit:name"] = function(unit)
  7.   local name = oUF.Tags.Methods["name"](unit)
  8.   local color GetUnitColor(unit)
  9.   if color then
  10.     return "|cff"..GetHexColor(color)..name.."|r"
  11.   else
  12.     return "|cffff00ff"..name.."|r"
  13.   end
  14. end
  15. oUF.Tags.Events["unit:name"] = "UNIT_NAME_UPDATE UNIT_CONNECTION"
  16.  
  17. --unit level tag
  18. oUF.Tags.Methods["unit:level"] = function(unit)
  19.   local level = oUF.Tags.Methods["level"](unit)
  20.   local color GetLevelColor(unit)
  21.   if color then
  22.     return "|cff"..GetHexColor(color)..level.."|r"
  23.   else
  24.     return "|cffff00ff"..level.."|r"
  25.   end
  26. end
  27. oUF.Tags.Events["unit:level"] = "UNIT_NAME_UPDATE UNIT_CONNECTION"
  28.  
  29. --unit health tag
  30. oUF.Tags.Methods["unit:health"] = function(unit)
  31.   local perhp = oUF.Tags.Methods["perhp"](unit)
  32.   local color GetHealthColor(unit)
  33.   if color then
  34.     return "|cff"..GetHexColor(color)..perhp.."|r"
  35.   else
  36.     return "|cffff00ff"..perhp.."|r"
  37.   end
  38. end
  39. oUF.Tags.Events["unit:health"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH"
  40.  
  41. --unit power tag
  42. oUF.Tags.Methods["unit:power"] = function(unit)
  43.   local perpp = oUF.Tags.Methods["perpp"](unit)
  44.   local color GetPowerColor(unit)
  45.   if color then
  46.     return "|cff"..GetHexColor(color)..perpp.."|r"
  47.   else
  48.     return "|cffff00ff"..perpp.."|r"
  49.   end
  50. end
  51. oUF.Tags.Events["unit:power"] = "UNIT_DISPLAYPOWER UNIT_POWER_FREQUENT UNIT_MAXPOWER"

Once you have the tags set up you can easily bind them to any font string. So in your unit style you set up 4 font strings.
Lua Code:
  1. --------------------------------------
  2.   --FONT STRINGS
  3.   --------------------------------------
  4.    
  5.   --fontstring func
  6.   local function NewFontString(parent,family,size,outline,layer)
  7.     local fs = parent:CreateFontString(nil, layer or "OVERLAY")
  8.     fs:SetFont(family,size,outline)
  9.     fs:SetShadowColor(0,0,0,1)
  10.     return fs
  11.   end
  12.  
  13.   local function CreateUnitStrings(self)
  14.      
  15.     local name = NewFontString(self, STANDARD_TEXT_FONT, 12, "THINOUTLINE")
  16.     name:SetPoint("CENTER", self, 0, 10)
  17.     self:Tag(name, "[unit:name]")
  18.      
  19.     local hpval = NewFontString(self, STANDARD_TEXT_FONT, 12, "THINOUTLINE")
  20.     hpval:SetPoint("RIGHT", name, 5,0)
  21.     self:Tag(hpval, "[unit:health]")
  22.      
  23.     local level = NewFontString(self, STANDARD_TEXT_FONT, 12, "THINOUTLINE")
  24.     level:SetPoint("CENTER", self, 0, -10)
  25.     self:Tag(level, "[unit:level]")
  26.      
  27.     local ppval = NewFontString(self, STANDARD_TEXT_FONT, 12, "THINOUTLINE")
  28.     ppval:SetPoint("RIGHT", level, 5,0)
  29.     self:Tag(ppval, "[unit:power]")
  30.    
  31.   end

Last part is to set up a unit template function and spawn your two units:
Lua Code:
  1. --------------------------------------
  2.   --STYLE TEMPLATE FUNC
  3.   --------------------------------------
  4.    
  5.   --style func
  6.   local function CreateUnitTemplate(self)
  7.     --create the unit strings
  8.     CreateUnitStrings(self)
  9.   end
  10.  
  11.   --------------------------------------
  12.   --UNIT SPAWN
  13.   --------------------------------------
  14.  
  15.   --register the style function
  16.   oUF:RegisterStyle("DefaultTemplate", CreateUnitTemplate)
  17.   oUF:SetActiveStyle("DefaultTemplate")
  18.  
  19.   --spawn player
  20.   oUF:Spawn("player","DefaultTemplate"):SetPoint("CENTER", UIParent, -100, 0)
  21.  
  22.   --spawn target
  23.   oUF:Spawn("target","DefaultTemplate"):SetPoint("CENTER", UIParent, 100, 0)

-- Bringing everything together --------------------

Thus the final result would be the following. Careful though I drycoded the whole thing. There may be typos.
Lua Code:
  1. --------------------------------------
  2.   --VARIABLES
  3.   --------------------------------------
  4.    
  5.   local PowerBarColor = PowerBarColor
  6.   local RAID_CLASS_COLORS = RAID_CLASS_COLORS
  7.   local FACTION_BAR_COLORS = FACTION_BAR_COLORS
  8.   local abs, floor, format = abs, floor, format
  9.    
  10.   --------------------------------------
  11.   --COLOR LIB
  12.   --------------------------------------
  13.    
  14.   --gradient color lib
  15.   local CS = CreateFrame("ColorSelect")
  16.    
  17.   --get HSV from RGB color
  18.   function CS:GetHSVColor(color)
  19.     self:SetColorRGB(color.r, color.g, color.b)
  20.     local h,s,v = self:GetColorHSV()
  21.     return {h=h,s=s,v=v}
  22.   end
  23.    
  24.   --get RGB from HSV color
  25.   function CS:GetRGBColor(color)
  26.     self:SetColorHSV(color.h, color.s, color.v)
  27.     local r,g,b = self:GetColorRGB()
  28.     return {r=r,g=g,b=b}
  29.   end
  30.    
  31.   --input two HSV colors and a percentage
  32.   --returns new HSV color
  33.   function CS:GetSmudgeColorHSV(colorA,colorB,percentage)
  34.     local colorC = {}
  35.     --check if the angle between the two H values is > 180
  36.     if abs(colorA.h-colorB.h) > 180 then
  37.       local angle = (360-abs(colorA.h-colorB.h))*percentage
  38.       if colorA.h < colorB.h then
  39.         colorC.h = floor(colorA.h-angle)
  40.         if colorC.h < 0 then
  41.           colorC.h = 360+colorC.h
  42.         end
  43.       else
  44.         colorC.h = floor(colorA.h+angle)
  45.         if colorC.h > 360 then
  46.           colorC.h = colorC.h-360
  47.         end
  48.       end
  49.     else
  50.       colorC.h = floor(colorA.h-(colorA.h-colorB.h)*percentage)
  51.     end    
  52.     colorC.s = colorA.s-(colorA.s-colorB.s)*percentage
  53.     colorC.v = colorA.v-(colorA.v-colorB.v)*percentage
  54.     return colorC
  55.   end
  56.    
  57.   local redColor = CS:GetHSVColor({r=1,g=0,b=0})
  58.   local greenColor = CS:GetHSVColor({r=0,g=1,b=0})
  59.    
  60.   --------------------------------------
  61.   --GET RGB as HEX-Color
  62.   --------------------------------------
  63.    
  64.   local function GetHexColor(color)
  65.     return format("%02x%02x%02x", color.r*255, color.g*255, color.b*255)
  66.   end
  67.    
  68.   --------------------------------------
  69.   --COLOR FUNCTIONS
  70.   --------------------------------------
  71.    
  72.   --GetPowerTypeColor func
  73.   local function GetPowerTypeColor(unit)
  74.     if not unit then return end
  75.     local id, power, r, g, b = UnitPowerType(unit)
  76.     local color = PowerBarColor[power]
  77.     if color then
  78.       r, g, b = color.r, color.g, color.b
  79.     end
  80.     return {r=r,g=g,b=b}
  81.   end
  82.    
  83.   --GetLevelColor func
  84.   local function GetLevelColor(unit)
  85.     if not unit then return end
  86.     return GetQuestDifficultyColor(unit)
  87.   end
  88.    
  89.   --GetUnitColor func
  90.   local function GetUnitColor(unit)
  91.     if not unit then return end
  92.     local color
  93.     if UnitIsDeadOrGhost(unit) or not UnitIsConnected(unit) then
  94.       color = {r = 0.5, g = 0.5, b = 0.5}
  95.     elseif UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) then
  96.       color = {r = 0.5, g = 0.5, b = 0.5}
  97.     elseif UnitIsPlayer(unit) then
  98.       color = RAID_CLASS_COLORS[select(2, UnitClass(unit))]
  99.     else
  100.       color = FACTION_BAR_COLORS[UnitReaction(unit, "player")]
  101.     end
  102.     return color
  103.   end
  104.    
  105.   --GetHealthColor func  
  106.   local function GetHealthColor(unit)
  107.     if not unit then return end
  108.     local hcur, hmax = UnitHealth(unit), UnitHealthMax(unit)
  109.     local hper = 0
  110.     if hmax > 0 then hper = hcur/hmax end
  111.     --you may need to swap red and green color
  112.     return CS:GetRGBColor(CS:GetSmudgeColorHSV(redColor,greenColor,hper))
  113.   end
  114.  
  115.   --------------------------------------
  116.   --TAGS
  117.   --------------------------------------
  118.    
  119.   --unit name tag
  120.   oUF.Tags.Methods["unit:name"] = function(unit)
  121.     local name = oUF.Tags.Methods["name"](unit)
  122.     local color GetUnitColor(unit)
  123.     if color then
  124.       return "|cff"..GetHexColor(color)..name.."|r"
  125.     else
  126.       return "|cffff00ff"..name.."|r"
  127.     end
  128.   end
  129.   oUF.Tags.Events["unit:name"] = "UNIT_NAME_UPDATE UNIT_CONNECTION"
  130.    
  131.   --unit level tag
  132.   oUF.Tags.Methods["unit:level"] = function(unit)
  133.     local level = oUF.Tags.Methods["level"](unit)
  134.     local color GetLevelColor(unit)
  135.     if color then
  136.       return "|cff"..GetHexColor(color)..level.."|r"
  137.     else
  138.       return "|cffff00ff"..level.."|r"
  139.     end
  140.   end
  141.   oUF.Tags.Events["unit:level"] = "UNIT_NAME_UPDATE UNIT_CONNECTION"
  142.    
  143.   --unit health tag
  144.   oUF.Tags.Methods["unit:health"] = function(unit)
  145.     local perhp = oUF.Tags.Methods["perhp"](unit)
  146.     local color GetHealthColor(unit)
  147.     if color then
  148.       return "|cff"..GetHexColor(color)..perhp.."|r"
  149.     else
  150.       return "|cffff00ff"..perhp.."|r"
  151.     end
  152.   end
  153.   oUF.Tags.Events["unit:health"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH"
  154.    
  155.   --unit power tag
  156.   oUF.Tags.Methods["unit:power"] = function(unit)
  157.     local perpp = oUF.Tags.Methods["perpp"](unit)
  158.     local color GetPowerColor(unit)
  159.     if color then
  160.       return "|cff"..GetHexColor(color)..perpp.."|r"
  161.     else
  162.       return "|cffff00ff"..perpp.."|r"
  163.     end
  164.   end
  165.   oUF.Tags.Events["unit:power"] = "UNIT_DISPLAYPOWER UNIT_POWER_FREQUENT UNIT_MAXPOWER"
  166.  
  167.  
  168.   --------------------------------------
  169.   --FONT STRINGS
  170.   --------------------------------------
  171.    
  172.   --fontstring func
  173.   local function NewFontString(parent,family,size,outline,layer)
  174.     local fs = parent:CreateFontString(nil, layer or "OVERLAY")
  175.     fs:SetFont(family,size,outline)
  176.     fs:SetShadowColor(0,0,0,1)
  177.     return fs
  178.   end
  179.  
  180.   local function CreateUnitStrings(self)
  181.      
  182.     local name = NewFontString(self, STANDARD_TEXT_FONT, 12, "THINOUTLINE")
  183.     name:SetPoint("CENTER", self, 0, 10)
  184.     self:Tag(name, "[unit:name]")
  185.      
  186.     local hpval = NewFontString(self, STANDARD_TEXT_FONT, 12, "THINOUTLINE")
  187.     hpval:SetPoint("RIGHT", name, 5,0)
  188.     self:Tag(hpval, "[unit:health]")
  189.      
  190.     local level = NewFontString(self, STANDARD_TEXT_FONT, 12, "THINOUTLINE")
  191.     level:SetPoint("CENTER", self, 0, -10)
  192.     self:Tag(level, "[unit:level]")
  193.      
  194.     local ppval = NewFontString(self, STANDARD_TEXT_FONT, 12, "THINOUTLINE")
  195.     ppval:SetPoint("RIGHT", level, 5,0)
  196.     self:Tag(ppval, "[unit:power]")
  197.    
  198.   end
  199.  
  200.  
  201.   --------------------------------------
  202.   --STYLE TEMPLATE FUNC
  203.   --------------------------------------
  204.    
  205.   --style func
  206.   local function CreateUnitTemplate(self)
  207.     --create the unit strings
  208.     CreateUnitStrings(self)
  209.   end
  210.  
  211.   --------------------------------------
  212.   --UNIT SPAWN
  213.   --------------------------------------
  214.  
  215.   --register the style function
  216.   oUF:RegisterStyle("DefaultTemplate", CreateUnitTemplate)
  217.   oUF:SetActiveStyle("DefaultTemplate")
  218.  
  219.   --spawn player
  220.   oUF:Spawn("player","DefaultTemplate"):SetPoint("CENTER", UIParent, -100, 0)
  221.  
  222.   --spawn target
  223.   oUF:Spawn("target","DefaultTemplate"):SetPoint("CENTER", UIParent, 100, 0)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-21-13 at 06:34 AM.
  Reply With Quote
10-21-13, 07:57 AM   #3
Jonisaurus
An Aku'mai Servant
 
Jonisaurus's Avatar
Join Date: Aug 2011
Posts: 35
Hey Zork,

thanks so much for taking time and coding all of that!
I read through it and I thought I understood it.

We create tag functions to attain information about HP, PP through the oUF functions and then return values. We then have a basic font string creation function which we use to create 4 font strings that themselves get information from the tag functions. Then we turn all of that into a template and spawn units with that template.

I still can't get it to work, though. Nothing happens when I try to load it up, except that the game becomes really choppy whenever I cast a spell. :/
I feel stupid!
  Reply With Quote
10-21-13, 08:26 AM   #4
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
I will try to translate it into a layout when I get home.

When you are coding make sure you go to your interface settings under help/others and enable "show lua errors". All lua errors have to be fixed in first place.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
10-21-13, 10:20 AM   #5
Jonisaurus
An Aku'mai Servant
 
Jonisaurus's Avatar
Join Date: Aug 2011
Posts: 35
That would be great, I could see what I did wrong then.

Last edited by Jonisaurus : 10-21-13 at 10:28 AM.
  Reply With Quote
10-21-13, 11:01 AM   #6
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Ok, I fixed the bugs.



Addon: http://www.wowinterface.com/download...oUF_Ascii.html
SVN: http://code.google.com/p/rothui/sour...5.0/oUF_Ascii/

*edit*
Added template functions and a targettarget unit.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-21-13 at 03:38 PM.
  Reply With Quote
10-22-13, 07:56 AM   #7
Jonisaurus
An Aku'mai Servant
 
Jonisaurus's Avatar
Join Date: Aug 2011
Posts: 35
Your layout works wonderfully.
I edited it according to my needs (for my own textures).
I have a few questions. :P
  1. The Power font colours, are those the standard WoW resource type colours? I think so. Is there a good way I can customise them? For this layout specifically or generally?
    If I do it for the layout I would have to add lots of code I think, right? Is there a way to just easily edit the resource type colours for all of WoW?


  2. And connecting to that, I'd like to assign a static colour to the HP fontstrings. Can I just substitute a fixed r,g,b colour into the GetHealthColour function or is that brutalist? Haha.


  3. The other thing I would like to do is make the position of each fontstring static so that for example the mana perPP fontstring doesn't jump to the right if the perHP fontstring becomes shorter (99 instead of 100 for example). I think I knew how to do this, but I forgot. It's done with the tags I think?

I'm also experimenting with your oUF_Donut ring addon. It is pretty cool. Compliments.

Last edited by Jonisaurus : 10-22-13 at 08:01 AM.
  Reply With Quote
10-22-13, 08:45 AM   #8
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
1.) instead of
Lua Code:
  1. local PowerBarColor  = PowerBarColor
do
Lua Code:
  1. local PowerBarColor = {}
  2. PowerBarColor["MANA"] = { r = 0.00, g = 0.00, b = 1.00 }
  3. PowerBarColor["RAGE"] = { r = 1.00, g = 0.00, b = 0.00 }
  4. PowerBarColor["FOCUS"] = { r = 1.00, g = 0.50, b = 0.25 }
  5. PowerBarColor["ENERGY"] = { r = 1.00, g = 1.00, b = 0.00 }
  6. PowerBarColor["CHI"] = { r = 0.71, g = 1.0, b = 0.92 }
  7. PowerBarColor["RUNES"] = { r = 0.50, g = 0.50, b = 0.50 }
  8. PowerBarColor["RUNIC_POWER"] = { r = 0.00, g = 0.82, b = 1.00 }
  9. PowerBarColor["SOUL_SHARDS"] = { r = 0.50, g = 0.32, b = 0.55 }
  10. PowerBarColor["ECLIPSE"] = { negative = { r = 0.30, g = 0.52, b = 0.90 },  positive = { r = 0.80, g = 0.82, b = 0.60 }}
  11. PowerBarColor["HOLY_POWER"] = { r = 0.95, g = 0.90, b = 0.60 }
  12. -- vehicle colors
  13. PowerBarColor["AMMOSLOT"] = { r = 0.80, g = 0.60, b = 0.00 }
  14. PowerBarColor["FUEL"] = { r = 0.0, g = 0.55, b = 0.5 }
  15. PowerBarColor["STAGGER"] = { {r = 0.52, g = 1.0, b = 0.52}, {r = 1.0, g = 0.98, b = 0.72}, {r = 1.0, g = 0.42, b = 0.42},}
  16.  
  17. -- these are mostly needed for a fallback case (in case the code tries to index a power token that is missing from the table,
  18. -- it will try to index by power type instead)
  19. PowerBarColor[0] = PowerBarColor["MANA"]
  20. PowerBarColor[1] = PowerBarColor["RAGE"]
  21. PowerBarColor[2] = PowerBarColor["FOCUS"]
  22. PowerBarColor[3] = PowerBarColor["ENERGY"]
  23. PowerBarColor[4] = PowerBarColor["CHI"]
  24. PowerBarColor[5] = PowerBarColor["RUNES"]
  25. PowerBarColor[6] = PowerBarColor["RUNIC_POWER"]
  26. PowerBarColor[7] = PowerBarColor["SOUL_SHARDS"]
  27. PowerBarColor[8] = PowerBarColor["ECLIPSE"]
  28. PowerBarColor[9] = PowerBarColor["HOLY_POWER"]

Adjust the colors accordingly.

2.) Yes you can. Just replace that with GetHealthColor(unit) with {r=1,g=0,b=0}. It makes me feel sad for the HSV color calc function though.
3.) You can do that easily. Just give your fontstrings a size, like: name:SetSize(64,32). You may need to experiment a bit with the sizes. You do that where you have your fontstring setpoints. Not instead, you do it additionally. As a hint...when you are doing such a thing make use of some textures. Like:
Lua Code:
  1. local texture = self:CreateTexture(nil, "BACKGROUND", nil, -8)
  2. texture:SetTexture(1,1,1)
  3. texture:SetVertexColor(1,0,0,0.2)
  4. texture:SetAllPoints(name)--variable of the fontstring name
That way you can check sizes more easily.

Gonna test some statusbar ideas in the next days.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-22-13 at 09:00 AM.
  Reply With Quote
10-22-13, 09:29 AM   #9
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Or, if you want a more concise syntax:
Lua Code:
  1. local PowerBarColor = {
  2.     MANA = { r = 0.00, g = 0.00, b = 1.00 },
  3.     RAGE = { r = 1.00, g = 0.00, b = 0.00 },
  4.     FOCUS = { r = 1.00, g = 0.50, b = 0.25 },
  5.     ENERGY = { r = 1.00, g = 1.00, b = 0.00 },
  6.     CHI = { r = 0.71, g = 1.0, b = 0.92 },
  7.     RUNES = { r = 0.50, g = 0.50, b = 0.50 },
  8.     RUNIC_POWER = { r = 0.00, g = 0.82, b = 1.00 },
  9.     SOUL_SHARDS = { r = 0.50, g = 0.32, b = 0.55 },
  10.     ECLIPSE = { negative = { r = 0.30, g = 0.52, b = 0.90 }, positive = { r = 0.80, g = 0.82, b = 0.60 } },
  11.     HOLY_POWER = { r = 0.95, g = 0.90, b = 0.60 },
  12.     -- vehicle colors
  13.     AMMOSLOT = { r = 0.80, g = 0.60, b = 0.00 },
  14.     FUEL = { r = 0.0, g = 0.55, b = 0.5 },
  15.     STAGGER = { { r = 0.52, g = 1.0, b = 0.52 }, { r = 1.0, g = 0.98, b = 0.72 }, { r = 1.0, g = 0.42, b = 0.42 }, },
  16. }
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
10-22-13, 12:00 PM   #10
Jonisaurus
An Aku'mai Servant
 
Jonisaurus's Avatar
Join Date: Aug 2011
Posts: 35
I wanted to give a kind of conceptual sample of what I'm working on.
I'm building a paintbrush themed minimalistic interface. Inspired a bit by Guild Wars 2.

Those are my own textures but they are still very rough. As you can see the player frame texture is already further than the target one. By the way, Illustrator sucks for .tga exportation. <.<



And Zork, that is your oUF_Donut layout. I experimented a bit with it, added some templates and edited the Alpha Channels of your texture to allow me to isolate one ring per frame that is transparent in the middle.

You built an amazing ring layout! It's a bit rough in animation and texture, but it works. It's far above my newbie coding knowledge but if you know how to smoothen up the circle edge texture and/or animation... But don't do it if you don't want to. :P

Last edited by Jonisaurus : 10-22-13 at 12:11 PM.
  Reply With Quote
10-23-13, 07:09 AM   #11
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
That is where the spark comes into play. A spark is a blend texture that will overlay harsh edges. The ring itself will by nice and shiny, but if you rotate the texture the former good looking ring edge will become harsh and bad looking. Using a spark can overlay that issue and give a nice effect as a bonus.

If you have a very small final ring make your ring texture small aswell. This can reduce fragments introduced by resizing.

Nice work btw.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-23-13 at 07:12 AM.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Minimalistic Text oUF


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