Game Development Reference
In-Depth Information
Exploring the GUITexture component
As we can now display 2D text, let's discuss how we can add visually appealing
graphics to our interfaces; the GUITexture component does precisely this. You can
see the GUITexture component as follows:
The Texture field is a reference to a 2D graphic element. This could be a .png , .jpg ,
or .bmp file that you created in the Paint program on your computer. Each file type
has its benefits and drawbacks depending on how much compression you need in
your file. Dragging-and-dropping it into the Project tab will import the image, after
which you can set the reference.
The Color field lets the user select a specific tint for the GUITexture . This is a con-
venient way to fine-tune the appearance of the texture without having to edit it in your
external Paint program.
The Pixel Inset field works in a way similar to the Pixel Offset field. The X and Y
fields correspond to the screen space coordinates of the upper-left corner of the tex-
ture. The Width and Height fields provide a way to stretch and scale the graphics
vertically and horizontally; combining these two lets the programmer place and resize
the visuals precisely.
The Left Border , Right Border , Top Border , and Bottom Border fields provide a
way to tile the texture to the left, right, top, or bottom of the original. These measure-
ments are in pixels as well and not in screen percentages.
Search WWH ::




Custom Search