Greetings.
I am creating a mod that will have a horizontal compass on the top center of the screen. I have an ImageWidget successfully loaded and I am trying to use ImageWidget.SetUV() to provide the UV Mapping for the image to serve as a texture on the widget as suggested by these BI code comments:
enum WidgetFlags { <...> CUSTOMUV, //< ignores STRETCH/FLIPU/FLIPV and take custom UV set by SetWidgetUV() <...> } class ImageWidget extends Widget { <...> /*! When WF_CUSTOMUV is set, we can supply our own UV coords instead of computed ones. \param uv Pointer to array of at least 8 floats (4 corners * 2 floats for u/v) */ proto native void SetUV(float uv[4][2]); }
My code is as follows..
ImageWidget m_CompassImage = ImageWidget.Cast(m_Root.FindAnyWidget("CompassImage")); float uv[4][2]; uv[0] = { 0.0, 0.0 }; // xMin, yMin uv[1] = { 0.0, 1.0 }; // xMin, yMax uv[2] = { 1.0, 1.0 }; // xMax, yMax uv[3] = { 1.0, 0.0 }; // xMax, yMin m_CompassImage.SetFlags(WidgetFlags.CUSTOMUV); m_CompassImage.SetUV(uv);
With the supplied UV map above, I am trying to mirror the texture on the image widget. However, I don't get anything.
Three questions for you:
- Can you help me understand how to use SetUV() the proper way?
- Could you provide a code snippet that might illuminate it's usage?
- Or can you confirm that it is broken or not functional?
Any help is very much appreciated.
Thanks,
Zap - PvPEngine
(Click for YouTube Channel of Mod progress)