Hey guys how are ya,
Im new to forums in terms of posting but i love the tuts you have and 
information on the Source engine

Well basically ive started work partime on a new mod using the OB engine and 
ive decided to start with my hud

I followed a tut in VDC as to how to print a simple vtf out on screen and i 
eventually got it to work and lord and behold i was not happy because i wanted 
an animated texture to display in the top right hand corner in the panel.

In the picture below you will notice my creation in the top right hand corner
http://www.interlopers.net/forum/download/file.php?id=1011
So i went ahead and designed a simple rotating devils trap like 
belowhttp://www.interlopers.net/forum/download/file.php?id=1012
I have made animated sprays for Insurgency and CS:S successfully with VTFEdit 
and i was hoping that it would be the same here but apparently not, even though 
i tested the VTF as a spray in cs:S and it works
I was wondering if anyone could help me with this on whether there is a method 
i can call like the paint() one that will paint an animated texture on screen

The code i used is posted below
hud_devils_trap.cpp

#include "hud.h"
#include "cbase.h"
#include "hud_devils_trap.h"
#include "iclientmode.h"
#include "hud_macros.h"
#include "vgui_controls/controls.h"
#include "vgui/ISurface.h"

#include "tier0/memdbgon.h"

using namespace vgui;

DECLARE_HUDELEMENT( CHudImport );

static ConVar show_beta("show_devilsTrap", "0", 0, "toggles my first edit on 
this mod, useless but cool to look at in upper right corner");

CHudImport::CHudImport( const char *pElementName ) : CHudElement( pElementName 
), BaseClass( NULL, "HudImport" )
{
   Panel *pParent = g_pClientMode->GetViewport();
   SetParent( pParent );   
   
   SetVisible( false );
   SetAlpha( 255 );

   //AW Create Texture for Looking around
   m_nImport = surface()->CreateNewTextureID();
   surface()->DrawSetTextureFile( m_nImport, "Hud/devilsTrap" , true, true);

   SetHiddenBits( HIDEHUD_PLAYERDEAD | HIDEHUD_NEEDSUIT );
}
void CHudImport::Paint()
{
   SetPaintBorderEnabled(false);
    surface()->DrawSetTexture( m_nImport );
   surface()->DrawTexturedRect( 2, 2, 128, 128 );
}
void CHudImport::togglePrint()
{
   if (!show_beta.GetBool())
      this->SetVisible(false);
   else
      this->SetVisible(true);
}
void CHudImport::OnThink()
{
   togglePrint();

   BaseClass::OnThink();
}
//////////////////////////////////////////////////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
my header =
hud_devils_trap.h

#include "hudelement.h"
#include <vgui_controls/Panel.h>

using namespace vgui;

class CHudImport : public CHudElement, public Panel
{
   DECLARE_CLASS_SIMPLE( CHudImport, Panel );

   public:
   CHudImport( const char *pElementName );
   void togglePrint();
   virtual void OnThink();

   protected:
   virtual void Paint();
   int m_nImport;
};
///////////////////////////////////////////////////////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

The important part of the HudLayout.res

 HudImport [$WIN32]
       {
               "fieldName"             "HudImport"
               "xpos" "r100"
               "ypos" "10"
               "wide" "86"
               "tall" "86"
               "visible" "0"
               "enabled" "1"
      
               "PaintBackgroundType"   "2"
        }
/////////////////////////////////////////////////////////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
And my devilsTrap.vmt code

"UnlitGeneric"
{
      "$basetexture" "hud/devilsTrap"
      "$translucent"   "1"
      "$translucency" "1"
      "$ignorez" "1"
}
///////////////////////////////////////////
I recently changed that code and now there is a scrambled image that i cant 
make out
the  code i used for it is below

"UnlitGeneric"
{
"$basetexture" "hud/devilsTrap"
"$translucent" 1 
"Proxies"
        {
                "AnimatedTexture"
                        {
                                "animatedTextureVar" "$basetexture"
                                "animatedTextureFrameNumVar" "$frame"
                                "animatedTextureFrameRate" "10"
                        }
        }
}
/////////////////////////////////////////////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
I know it looks a bit complicated but the results of displaying a vtf in the 
top right hand corner is nice but an animated one would be nicer i hope someone 
can shed light on whether what i hope to do is possible or not because i would 
implement it in a panel in my menu for the mod
Cheers
Foofighter


Send instant messages to your online friends http://uk.messenger.yahoo.com 
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to