diff options
| author | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
| commit | 39ed87570bdb2f86969d4be821c94b722dc71179 (patch) | |
| tree | abc53757f75f40c80278e87650ea92808274aa59 /mp/src/game/client/vgui_bitmapimage.h | |
| download | source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip | |
First version of the SOurce SDK 2013
Diffstat (limited to 'mp/src/game/client/vgui_bitmapimage.h')
| -rw-r--r-- | mp/src/game/client/vgui_bitmapimage.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/mp/src/game/client/vgui_bitmapimage.h b/mp/src/game/client/vgui_bitmapimage.h new file mode 100644 index 00000000..790e3650 --- /dev/null +++ b/mp/src/game/client/vgui_bitmapimage.h @@ -0,0 +1,94 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef VGUI_BITMAPIMAGE_H
+#define VGUI_BITMAPIMAGE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include <vgui_controls/Image.h>
+
+namespace vgui
+{
+ class Panel;
+}
+
+class KeyValues;
+struct Bitmap_t;
+
+//-----------------------------------------------------------------------------
+// Purpose: Bitmap image
+//-----------------------------------------------------------------------------
+class BitmapImage : public vgui::Image
+{
+public:
+ BitmapImage();
+ BitmapImage( vgui::VPANEL pPanelSize, const char *pFileName );
+ virtual ~BitmapImage();
+ bool Init( vgui::VPANEL pParent, const char *pFileName );
+ bool Init( vgui::VPANEL pParent, KeyValues* pInitData );
+
+ /* FIXME: Bleah!!! Don't want two different KeyValues
+ bool Init( vgui::VPANEL pParent, KeyValues* pInitData ); */
+
+ void DoPaint( vgui::VPANEL panel, float yaw = 0, float flAlphaModulate = 1.0f );
+ void DoPaint( int x, int y, int w, int h, float yaw = 0, float flAlphaModulate = 1.0f );
+ void Paint( );
+ void SetColor( const Color& clr );
+ Color GetColor( );
+ void GetColor( int& r,int& g,int& b,int& a );
+ void GetSize( int& wide, int& tall );
+ void SetPos( int x, int y );
+ void SetRenderSize( int x, int y );
+
+ void SetImageFile( const char *newImage );
+
+ // Pass NULL in to use the size set in SetSize
+ // otherwise it'll use the size of the panel
+ void UsePanelRenderSize( vgui::VPANEL pPanel );
+ vgui::VPANEL GetRenderSizePanel( void );
+
+ void SetViewport( bool use, float left, float top, float right, float bottom );
+
+ /// Set raw bitmap data
+ void SetBitmap( const Bitmap_t &bitmap );
+
+ /// Clean up vgui resources
+ void DestroyTexture();
+
+private:
+ int m_nTextureId;
+ Color m_clr;
+ int m_pos[2];
+ int m_Size[2];
+ vgui::VPANEL m_pPanelSize;
+
+ bool m_bUseViewport;
+ float m_rgViewport[ 4 ];
+ bool m_bProcedural;
+};
+
+
+//-----------------------------------------------------------------------------
+// Helper method to initialize a bitmap image from KeyValues data..
+// KeyValues contains the bitmap data. pSectionName, if it exists,
+// indicates which subsection of pInitData should be looked at to get at the
+// image data. The parent argument specifies which panel to use as parent,
+// and the final argument is the bitmap image to initialize.
+// The function returns true if it succeeded.
+//
+// NOTE: This function looks for the key values 'material' and 'color'
+// and uses them to set up the material + modulation color of the image
+//-----------------------------------------------------------------------------
+bool InitializeImage( KeyValues *pInitData, const char* pSectionName, vgui::Panel *pParent, BitmapImage* pBitmapImage );
+
+/* FIXME: How sad. We need to make KeyValues + vgui::KeyValues be the same. Bleah
+bool InitializeImage( KeyValues *pInitData, const char* pSectionName, vgui::Panel *pParent, BitmapImage* pBitmapImage ); */
+
+
+#endif // VGUI_BITMAPIMAGE_H
|