Files
SA-MP/saco/d3d9/common/DXUTgui.h

100 lines
2.9 KiB
C
Raw Normal View History

//--------------------------------------------------------------------------------------
// File: DXUTgui.h
//
// Desc:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------
#pragma once
#ifndef DXUT_GUI_H
#define DXUT_GUI_H
//--------------------------------------------------------------------------------------
// Enums for pre-defined control types
//--------------------------------------------------------------------------------------
enum DXUT_CONTROL_STATE
{
DXUT_STATE_NORMAL = 0,
DXUT_STATE_DISABLED,
DXUT_STATE_HIDDEN,
DXUT_STATE_FOCUS,
DXUT_STATE_MOUSEOVER,
DXUT_STATE_PRESSED,
};
#define MAX_CONTROL_STATES 6
struct DXUTBlendColor
{
void Init( D3DCOLOR defaultColor, D3DCOLOR disabledColor = D3DCOLOR_ARGB(200, 128, 128, 128), D3DCOLOR hiddenColor = 0 );
void Blend( UINT iState, float fElapsedTime, float fRate = 0.7f );
D3DCOLOR States[ MAX_CONTROL_STATES ]; // Modulate colors for all possible control states
D3DXCOLOR Current;
};
2024-05-15 22:49:02 +08:00
//-----------------------------------------------------------------------------
// Contains all the display tweakables for a sub-control
//-----------------------------------------------------------------------------
class CDXUTElement
{
public:
UINT iTexture; // Index of the texture for this Element
UINT iFont; // Index of the font for this Element
DWORD dwTextFormat; // The format argument to DrawText
RECT rcTexture; // Bounding rect of this element on the composite texture
DXUTBlendColor TextureColor;
DXUTBlendColor FontColor;
};
//--------------------------------------------------------------------------------------
// Structs for shared resources
//--------------------------------------------------------------------------------------
struct DXUTTextureNode
{
TCHAR strFilename[MAX_PATH];
IDirect3DTexture9* pTexture;
DWORD dwWidth;
DWORD dwHeight;
};
struct DXUTFontNode
{
TCHAR strFace[MAX_PATH];
ID3DXFont* pFont;
LONG nHeight;
LONG nWeight;
};
//-----------------------------------------------------------------------------
// Manages shared resources of dialogs
//-----------------------------------------------------------------------------
class CDXUTDialogResourceManager
{
public:
CDXUTDialogResourceManager();
HRESULT OnResetDevice();
void OnLostDevice();
void OnDestroyDevice();
// Shared between all dialogs
IDirect3DStateBlock9* m_pStateBlock;
ID3DXSprite* m_pSprite; // Sprite used for drawing
protected:
CGrowableArray< DXUTTextureNode* > m_TextureCache; // Shared textures
CGrowableArray< DXUTFontNode* > m_FontCache; // Shared fonts
IDirect3DDevice9* m_pd3dDevice;
};
#endif // DXUT_GUI_H