## XIDInterf
Class XIIITextureButton

source: C:\XIII\XIDInterf\Classes\XIIITextureButton.uc

    Core.Object
       |
       +--GUI.GUI
          |
          +--GUI.GUIComponent
             |
             +--GUI.GUILabel
                |
                +--XIDInterf.XIIIGUIBaseButton
                   |
                   +--XIDInterf.XIIITextureButton

Direct Known Subclasses:None

class XIIITextureButton
extends XIDInterf.XIIIGUIBaseButton

Variables
`TextX,` | `TextY`
`bZoomIn,` | `bUseBorder`
`fPS2XPatch,` | `fPS2YPatch`
`fXStretch,` | `fYStretch`
`tFourthTex[2],` | `tAdjustTex[2]`
`yoff,` | `zoom`

Function Summary
`void` | `BeforePaint(Canvas C, float X, float Y)`
`void` | `Created()`
`void` | `MouseEnter()`
    //____________________________________________________________________
    // MLK    Highlights the text
`void` | `MouseLeave()`
    //____________________________________________________________________
    // MLK    the button is darkened when no mouse on
`void` | `Paint(Canvas C, float X, float Y)`
    //____________________________________________________________________
    // MLK    Print the text clipped to the dimensions of the button

Source Code

    00001	class XIIITextureButton extends XIIIGUIBaseButton;
    00002
    00003	var  int    TextX, TextY;
    00004	var texture tFirstTex[2], tSecondTex[2], tThirdTex[2], tFourthTex[2], tAdjustTex[2];
    00005	var float   xoff, yoff, zoom;
    00006	var float fXStretch, fYStretch;
    00007	var float fPS2XPatch, fPS2YPatch;
    00008	var bool bDisplayTex, bZoomIn, bUseBorder;
    00009
    00010
    00011	function Created()
    00012	{
    00013	    super.Created();
    00014	    fPS2XPatch = 1.0; fPS2YPatch = 1.0;
    00015	}
    00016
    00017
    00018	function BeforePaint(Canvas C, float X, float Y)
    00019	{
    00020	     local float W, H;
    00021
    00022	     super.BeforePaint(C, X, Y);
    00023
    00024	     if (bZoomIn)
    00025		 {
    00026	       zoom+=0.067;
    00027		   if (zoom > 1.0)
    00028		   {
    00029	            bZoomIn = false;
    00030	            zoom = 1.0;
    00031	       }
    00032	     }
    00033
    00034	     if (tFirstTex[1] != none)
    00035	     {
    00036	        if (tFirstTex[1].USize < xoff) fPS2XPatch = xoff/tFirstTex[1].USize;
    00037	        if (tFirstTex[1].VSize < yoff) fPS2YPatch = yoff/tFirstTex[1].VSize;
    00038	     }
    00039	     if (tFourthTex[1] != none)
    00040	     {
    00041	        fXStretch = WinWidth*640*fRatioX / (tSecondTex[1].USize + xoff);
    00042	        fYStretch = WinHeight*480*fRatioY / (tThirdTex[1].VSize + yoff);
    00043	     }
    00044	     else if (tSecondTex[1] != none)
    00045	     {
    00046	        fXStretch = WinWidth*640*fRatioX / (tSecondTex[1].USize*fPS2XPatch + xoff);
    00047	        fYStretch = WinHeight*480*fRatioY / (tSecondTex[1].VSize*fPS2YPatch + yoff);
    00048	     }
    00049	}
    00050
    00051
    00052	//____________________________________________________________________
    00053	// MLK    Print the text clipped to the dimensions of the button
    00054	function Paint(Canvas C,float X,float Y)
    00055	{
    00056	     local byte Bank;
    00057
    00058	//     if (C.Viewport != myRoot.ViewportOwner) return;
    00059
    00060	     super.Paint(C,X,Y);
    00061
    00062	     C.bUseBorder = bUseBorder;
    00063	     DrawStretchedTexture(C, 0, 0, WinWidth, WinHeight, myRoot.FondMenu);
    00064	     C.bUseBorder = false;
    00065
    00066	     Bank = byte(bDisplayTex);
    00067	        if (tFourthTex[Bank] != none)
    00068	        {
    00069	            DrawStretchedTexture(C, 0, 0, tFirstTex[Bank].USize*fPS2XPatch*fXStretch, tFirstTex[Bank].VSize*fPS2YPatch*fYStretch, tFirstTex[Bank]); // X-YPad
    00070	            DrawStretchedTexture(C, xoff*fXStretch, 0, tSecondTex[Bank].USize*fXStretch, tSecondTex[Bank].VSize*fYStretch, tSecondTex[Bank]);
    00071	            DrawStretchedTexture(C, 0, yoff*fYStretch, tThirdTex[Bank].USize*fPS2XPatch*fXStretch, tThirdTex[Bank].VSize*fPS2YPatch*fYStretch, tThirdTex[Bank]); // X/Y Pad
    00072	            DrawStretchedTexture(C, xoff*fXStretch, yoff*fYStretch, tFourthTex[Bank].USize*fPS2XPatch*fXStretch, tFourthTex[Bank].VSize*fYStretch, tFourthTex[Bank]);
    00073	            if (tAdjustTex[Bank] != none)
    00074	                DrawStretchedTexture(C, xoff*fXStretch, tSecondTex[Bank].VSize*fYStretch, tAdjustTex[Bank].USize*fPS2XPatch*fXStretch, tAdjustTex[Bank].VSize*fYStretch, tAdjustTex[Bank]);
    00075	        }
    00076	        else if (tSecondTex[Bank] != none)
    00077	        {
    00078	            DrawStretchedTexture(C, 0, 0, tFirstTex[Bank].USize*fPS2XPatch*fXStretch, tFirstTex[Bank].VSize*fPS2YPatch*fYStretch, tFirstTex[Bank]);
    00079	            DrawStretchedTexture(C, xoff*fXStretch, yoff*fYStretch, tSecondTex[Bank].USize*fPS2XPatch*fXStretch, tSecondTex[Bank].VSize*fPS2YPatch*fYStretch, tSecondTex[Bank]);
    00080	        }
    00081	        else if (tFirstTex[Bank] != none)
    00082	            DrawStretchedTexture(C, 0, 0, WinWidth, WinHeight, tFirstTex[Bank]);
    00083	}
    00084
    00085
    00086	//____________________________________________________________________
    00087	// MLK    the button is darkened when no mouse on
    00088	function MouseLeave()
    00089	{
    00090	     bDisplayTex = false;
    00091	// NL1106     zoom = 0;
    00092	     Super.MouseLeave();
    00093	}
    00094
    00095	//____________________________________________________________________
    00096	// MLK    Highlights the text
    00097	function MouseEnter()
    00098	{
    00099	// NL1106
    00100	    zoom = 0;
    00101	// LN
    00102	     bZoomIn = true;
    00103	     bDisplayTex = true;
    00104	/*
    00105	     if (tFourthTex[1] != none)
    00106	     {
    00107	        fXStretch = WinWidth*640 / (tSecondTex[1].USize + xoff);
    00108	        fYStretch = WinHeight*480 / (tThirdTex[1].VSize + yoff);
    00109	     }
    00110	     else if (tSecondTex[1] != none)
    00111	     {
    00112	        fXStretch = WinWidth*640 / (tSecondTex[1].USize + xoff);
    00113	        fYStretch = WinHeight*480 / (tSecondTex[1].VSize + yoff);
    00114	     }
    00115	*/
    00116	     Super.MouseEnter();
    00117	}
    00118
    00119
    00120
    00121	defaultproperties
    00122	{
    00123	     bUseBorder=True
    00124	}

End Source Code