# SpatialFear.SFIconWindow

00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 |
    //=============================================================================
    // Spatial Fear
    // Name: SFIconWindow
    // Description: Window class to display an HUD icon
    //
    // Author: Markus Nuebel
    // Modified By: Chris Rogers
    //=============================================================================

    class SFIconWindow extends SFFadeWindow;

    var Texture m_texIcon;	// Private: The icon to display
    var int m_nWidth; // Private: width of icon in texture file
    var int m_nHeight; // Private: height of icon in texture file
    var int m_nDisplaySize;	// Private: Icon size for display

    // All initialization stuff
    simulated function init(float fHUDScale, int X, int Y, int nWidth, int nHeight, optional Pawn Owner, optional string strText, optional SFWindow wndParent)
    {
    	// First init base class
    	Super.init(fHUDScale, X, Y, nWidth, nHeight, Owner, strText, wndParent);

    	// Save parameters
    	m_fHUDScale	= fHUDScale;
    	m_nWidth	= nWidth;
    	m_nHeight	= nHeight;
    }

    // Sets the icon size for display
    simulated function setDisplaySize(int nSize)
    {
    	m_nDisplaySize=nSize;
    }

    // Sets the icon to use a background for this window
    simulated function setTexture(Texture texIcon)
    {
    	// Save reference
    	m_texIcon = texIcon;
    }

    // Cleanup
    simulated function terminate()
    {
    	// Call to base class
    	Super.terminate();

    	// Release references
    	m_texIcon = None;
    }

    // Overwritten here to render the bitmap icon
    simulated function renderBackground(Canvas C)
    {
    	local int	nOldStyle;

    	// Call to base class
    	Super.renderBackground(C);
    	// Save the old style
    	nOldStyle	= C.Style;
    	// Draw the icon
    	C.Style	= ERenderStyle.STY_Translucent;
    	C.SetPos(m_XCur*m_fHUDScale,m_YCur*m_fHUDScale);
    	C.DrawTile(m_texIcon, m_nDisplaySize*m_fHUDScale, m_nDisplaySize*m_fHUDScale, 0,0, m_nWidth,m_nHeight);
    	//C.DrawTile(m_texIcon, m_nWidth*m_fHUDScale, m_nHeight*m_fHUDScale, 0,0, m_nWidth,m_nHeight);
    	// Restore style
    	C.Style	= nOldStyle;

    }

    // Overwritten here to set the appropriate canvas style

    simulated function prepareCanvas(Canvas C)
    {
    	// Call to base class
    	Super.prepareCanvas(C);

    }

    defaultproperties
    {
         m_nDisplaySize=32
         m_bNoFade=True
    }

class file time: 12/7/2003 3:58:24 PM - creation time: 12/7/2003 4:03:44 PM
Created with UnCodeX