WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Graphics Help (https://www.wowinterface.com/forums/forumdisplay.php?f=14)
-   -   Beginner: Custom Graphic (https://www.wowinterface.com/forums/showthread.php?t=21604)

Geebles 04-01-09 04:10 PM

Beginner: Custom Graphic
 
I've been trying all day to make my "hello world" addon display a custom graphic on the screen. (since it is the basic bones of an addon that works) I've looked at so many things and haven't gotten anywhere.

I wonder if someone could show me some xml code to display a custom graphic on the screen?

I just want to take a png in photoshop, convert it to the right format, put it in the addon's folder, and see how to get that on the screen in the simplest way possible. I haven't been able to find a simple example anywhere that actually works to help me get started... :confused:

Maul 04-01-09 04:28 PM

Code:

        <Frame name="MyImageFrame" parent="UIParent">
                <Size x="50" y="50"/>
                <Anchors>
                        <Anchor point="CENTER"/>
                </Acnhors>
                <Layers>
                        <Layer level="OVERLAY">
                                <Texture name="$parentMyImage" file="Interface\AddOns\MyAddon\MyImageName.tga">
                                        <Size x="50" y="50"/>
                                        <Anchors>
                                                <Anchor point="CENTER"/>
                                        </Anchors>
                                </Texture>
                        </Layer>
                </Layers>
        </Frame>

Thia would be one basic XML way. Replace the file path with one to your file. Make sure your texture is WoW compliant :)

Samsan 05-20-09 08:54 PM

Custom Graphic in XML
 
Here's an example of code I use to create a piece of frame background. The images don't have to be in a seperate directory but personally I do it for a little more organization. This is a snippet from my frame background, it's 1 of 6 pieces. I also found that WoW prefers images with dimensions of 256 x 256, 512 x 512 and so on but smaller ones 128 x 64, 32 x 32, 64 x 64 etc. It was trial and error to get the sizing right for me.

I use "Gimp" to create the tga's, "Tilesplitter" to make the 256 squares and believe it or not "Windows Paint" to create the original images.


Hope this helps

Code:

    <Frame name="TopSkinTexture1Right">
        <Size>
          <AbsDimension x="512" y="32" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="245" y="-31" />
            </Offset>
          </Anchor>
        </Anchors>
        <Layers>
          <Layer Level="ARTWORK">
            <Texture name="DWMBgS2" setAllPoints="true" file="interface\AddOns\yourmod\images\Purple-Panel_S1a">
              <TexCoords left="0" right="1" top="0" bottom="1" />
            </Texture>
          </Layer>
        </Layers>
        </Frame>


Exawatt 05-23-09 09:11 AM

BLP and TGA files (only two accepted) need to have dimensions of power-of-two numbers (up to 2^10). By that I mean only 16, 32, 64, 128, 256, 512, and 1024 are valid as either width or height. They also must be in 256 colors (8 bits per pixel).

An image can be 32x512, but not 30x500. If you want a different part of it in game, then you take only a portion of that file using the <TexCoords> tag. If you want a different size, then you resize it (the selected area) with the <Size> tag. As a side note; I have files where half of the image file is unused, simply because it's width is a couple of pixels over a limit, and I had to use the next size up.

Here is a decent tutorial, though it is very old... Around page 6 or so it starts talking about textures.

Seerah 05-23-09 11:42 AM

Here is a more recent guide: http://forums.wowace.com/showthread.php?t=15439


All times are GMT -6. The time now is 06:19 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI