Drawing a texture on top of fontstring
Hi all,
Both texture and fontstring are drawn on same frame (frame.Health), but each are created via two separate functions, ComposeNameText() and ComposeReadyCheckIndicator() where ReadyCheckIndicator is created after NameText. Lua Code:
Lua Code:
Here's what it looks like at the moment. I tried to use 'sublevel' argument, but unlike texture, fontstring doesn't seem to have a sublevel argument :( At this stage, I've changed fontstring's draw layer to "ARTWORK" as a temporary solution. My question is would modifying draw layer be the only solution to solve this problem? |
Quote:
|
Quote:
|
Regions should have a sublevel argument; the fourth parameter on creation:
Lua Code:
All regions also have the :SetDrawLayer method. Lua Code:
|
Hi
@Game92, thank you for your idea, but I don't want to waste a resource only to draw one region on top of another ;) @Gethe & MunkDev, After I've posted this, I tried SetDrawLayer, but no luck :( It still has a same result as it's shown below. Lua Code:
AFAIK, sublevel argument should change the rendering order of regions in same layer where 7 is the highest order while -8 is the lowest order, but the texture is still drawn at the back :confused: I also tested with different layers, but still didn't work out.. *EDIT: Creating fontstring after texture did not solve this problem as well. |
Have you tried setting the BlendMode?
|
The "problem" is that FontStrings ALWAYS use the highest sublevel of the layer, it doesn't matter what your set.
So to address your issue, I'd either put your text on a lower layer: ARTWORK, or move your texture to a higher layer: HIGHLIGHT. Lua Code:
Creating additional frames and using them as parents for your FontStrings and Textures is a solution too, it's viable if you have really complex unit frames w/ multiple layers of textures and/or texts, otherwise it's an overkill. |
Hi
@Fizzlemizz, No, I haven't tried that one, but would that do a trick in this case? @lightspark, Ah..... that's why....... I didn't know that fontstring takes the highest place of sublevel :( In my case, I should put texture on "OVERLAY" and text on "ARTWORK", right? (Since I am expecting texture to be on top of text) |
Quote:
Also, you can assign layers and sublevels by passing them to CreateTexture and CreateFontString. I dunno why you're using SetDrawLayer. |
Quote:
I only read your comment, not code :p Quote:
Quote:
So I chose to use SetDrawLayer instead of setting layer and sublevel argument on Creation. But, since I know that fontstrings are always set to have highest sublevel, I don't need to use SetDrawLayer like you said :) Thanks for clarification. |
Quote:
|
Quote:
|
Quote:
|
All times are GMT -6. The time now is 04:27 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI