当前位置: 首页>>代码示例>>C++>>正文


C++ CDXUTDialog::GetWidth方法代码示例

本文整理汇总了C++中CDXUTDialog::GetWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ CDXUTDialog::GetWidth方法的具体用法?C++ CDXUTDialog::GetWidth怎么用?C++ CDXUTDialog::GetWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDXUTDialog的用法示例。


在下文中一共展示了CDXUTDialog::GetWidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

// Create any D3D11 resources that depend on the back buffer
HRESULT CALLBACK OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapChain* pSwapChain,
                                          const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
{
    HRESULT hr;
    V_RETURN( gDialogResourceManager.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );
    V_RETURN( gD3DSettingsDlg.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );

	gSurfaceWidth = pBackBufferSurfaceDesc->Width;
	gSurfaceHeight = pBackBufferSurfaceDesc->Height;

    gHUD.SetLocation( gSurfaceWidth - gHUD.GetWidth(), 0 );
	gSampleUI.SetLocation( gSurfaceWidth-gSampleUI.GetWidth(), gSurfaceHeight-gSampleUI.GetHeight() );

    return S_OK;
}
开发者ID:Nuos,项目名称:ISPCTextureCompressor,代码行数:16,代码来源:main.cpp

示例2: OnResetDevice

HRESULT CALLBACK OnResetDevice(IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext)
{
    HRESULT hr;

    V_RETURN(g_DialogResourceManager.OnD3D9ResetDevice());

    if(g_pFont)
        V_RETURN(g_pFont->OnResetDevice());

    V_RETURN(D3DXCreateSprite(pd3dDevice, &g_pTextSprite));

    V_RETURN(g_Board.OnResetDevice(pd3dDevice, pBackBufferSurfaceDesc));
    V_RETURN(g_BackgroundQuad.OnResetDevice());

    D3DXMATRIXA16 matrix;
    D3DXMatrixIdentity(&g_BackgroundQuad.World);

    D3DXMatrixScaling(&matrix, (float)pBackBufferSurfaceDesc->Width, (float)pBackBufferSurfaceDesc->Height,
                       1.0f);
    D3DXMatrixMultiply(&g_BackgroundQuad.World, &g_BackgroundQuad.World, &matrix);

    D3DXMatrixTranslation(&matrix, (float)pBackBufferSurfaceDesc->Width / 2.0f, pBackBufferSurfaceDesc->Height /
                           2.0f, 0.0f);
    D3DXMatrixMultiply(&g_BackgroundQuad.World, &g_BackgroundQuad.World, &matrix);

    g_Board.SetPosition(D3DXVECTOR3(pBackBufferSurfaceDesc->Width / 2.0f, pBackBufferSurfaceDesc->Height / 2.0f,
                                      0));
    g_Board.SetSize(min(pBackBufferSurfaceDesc->Height, pBackBufferSurfaceDesc->Width) * 0.7f);

    g_WhiteArrowDialog.SetLocation(100, pBackBufferSurfaceDesc->Height / 2 - g_WhiteArrowDialog.GetHeight() / 2);
    g_BlackArrowDialog.SetLocation(-100 + pBackBufferSurfaceDesc->Width - g_BlackArrowDialog.GetWidth(),
                                    pBackBufferSurfaceDesc->Height / 2 - g_BlackArrowDialog.GetHeight() / 2);

    g_TheWhiteWinnerDialog.SetLocation(50, pBackBufferSurfaceDesc->Height - 100);
    g_TheBlackWinnerDialog.SetLocation(50, pBackBufferSurfaceDesc->Height - 100);

    float fAspectRatio = pBackBufferSurfaceDesc->Width / (FLOAT)pBackBufferSurfaceDesc->Height;
    g_Camera.SetProjParams(D3DX_PI / 4, fAspectRatio, 0.1f, 1000.0f);
    g_Camera.SetWindow(pBackBufferSurfaceDesc->Width, pBackBufferSurfaceDesc->Height);

    g_HUD.SetLocation(pBackBufferSurfaceDesc->Width - 170, 0);
    g_HUD.SetSize(170, 170);
    g_SampleUI.SetLocation(pBackBufferSurfaceDesc->Width - 170, 0);
    g_SampleUI.SetSize(170, 300);

    return S_OK;
}
开发者ID:Bastila,项目名称:c-plus-plus-examples,代码行数:47,代码来源:NsRenju.cpp

示例3: InitApp

void InitApp()
{
    g_HUD.Init(&g_DialogResourceManager);
    g_SampleUI.Init(&g_DialogResourceManager);
    g_WhiteArrowDialog.Init(&g_DialogResourceManager);
    g_BlackArrowDialog.Init(&g_DialogResourceManager);
	g_TheWhiteWinnerDialog.Init(&g_DialogResourceManager);
	g_TheBlackWinnerDialog.Init(&g_DialogResourceManager);

    g_HUD.SetCallback(OnGUIEvent); int iY = 10;
    g_HUD.AddButton(IDC_TOGGLEFULLSCREEN, L"Toggle Full Screen", 35, iY, 125, 22);
    g_HUD.AddButton(IDC_HIDECONSOLE, L"Console", 35, iY += 24, 125, 22);
    g_HUD.AddButton(IDC_LAUNCH_RENJU_MANUAL, L"Manual", 35, iY += 24, 125, 22);
    g_HUD.AddButton(IDC_RESETGAME, L"Start", 35, iY += 24, 125, 22);

	g_SampleUI.AddRadioButton(IDC_GAMEMODE_HUMAN_HUMAN_RADIO, 1, L"Human - Human", 35, iY += 24, 220, 24, true, L'1');
    g_SampleUI.AddRadioButton(IDC_GAMEMODE_AI_IS_BLACK_RADIO, 1, L"AI is Black", 35, iY += 24, 220, 24, false, L'2');
    g_SampleUI.AddRadioButton(IDC_GAMEMODE_AI_IS_WHITE_RADIO, 1, L"AI is White", 35, iY += 24, 220, 24, false, L'3');

	g_SampleUI.SetCallback(OnGUIEvent);

    CDXUTStatic* pStatic = NULL;
    CDXUTElement* pElement = g_WhiteArrowDialog.GetDefaultElement(DXUT_CONTROL_STATIC, 0);
    if(pElement)
    {
        pElement->FontColor.Init(D3DCOLOR_ARGB(255, 255, 255, 255));
    }

    g_WhiteArrowDialog.SetSize(150, 100);
    g_WhiteArrowDialog.SetBackgroundColors(D3DCOLOR_ARGB(0, 255, 255, 255), D3DCOLOR_ARGB(0, 255, 255, 255),
                                            D3DCOLOR_ARGB(0, 255, 255, 255), D3DCOLOR_ARGB(0, 255, 255, 255));
    g_WhiteArrowDialog.SetCallback(OnGUIEvent);
    g_WhiteArrowDialog.SetFont(0, L"Arial", 120, FW_BOLD);
    g_WhiteArrowDialog.AddStatic(IDC_WHITESCORE, L"2", 0, 0, g_WhiteArrowDialog.GetWidth(),
                                  g_WhiteArrowDialog.GetHeight(), false, &pStatic);

    pElement = g_BlackArrowDialog.GetDefaultElement(DXUT_CONTROL_STATIC, 0);
    if(pElement)
    {
        pElement->FontColor.Init(D3DCOLOR_ARGB(255, 0, 0, 0));
    }

    g_BlackArrowDialog.SetSize(150, 100);
    g_BlackArrowDialog.SetBackgroundColors(D3DCOLOR_ARGB(0, 16, 16, 16), D3DCOLOR_ARGB(0, 16, 16, 16),
                                            D3DCOLOR_ARGB(0, 16, 16, 16), D3DCOLOR_ARGB(0, 16, 16, 16));
    g_BlackArrowDialog.SetCallback(OnGUIEvent);
    g_BlackArrowDialog.SetFont(0, L"Arial", 120, FW_BOLD);
    g_BlackArrowDialog.AddStatic(IDC_BLACKSCORE, L"2", 0, 0, g_BlackArrowDialog.GetWidth(),
                                  g_BlackArrowDialog.GetHeight(), false, &pStatic);

	pElement = g_TheWhiteWinnerDialog.GetDefaultElement(DXUT_CONTROL_STATIC, 0);
    if(pElement)
    {
       pElement->FontColor.Init(D3DCOLOR_ARGB(255, 255, 255, 255));
    }

    pElement = g_TheWhiteWinnerDialog.GetDefaultElement(DXUT_CONTROL_STATIC, 0);
    g_TheWhiteWinnerDialog.SetSize(500, 100);
    g_TheWhiteWinnerDialog.SetBackgroundColors(D3DCOLOR_ARGB(0, 16, 16, 16), D3DCOLOR_ARGB(0, 16, 16, 16),
                                            D3DCOLOR_ARGB(0, 16, 16, 16), D3DCOLOR_ARGB(0, 16, 16, 16));
    g_TheWhiteWinnerDialog.SetCallback(OnGUIEvent);
    g_TheWhiteWinnerDialog.SetFont(0, L"Arial", 60, FW_BOLD);
    g_TheWhiteWinnerDialog.AddStatic(IDC_THE_WHITE_WINNER_DIALOG, L"2", 0, 0, g_TheWhiteWinnerDialog.GetWidth(),
                                  g_TheWhiteWinnerDialog.GetHeight(), false, &pStatic);

	pElement = g_TheBlackWinnerDialog.GetDefaultElement(DXUT_CONTROL_STATIC, 0);
    if(pElement)
    {
       pElement->FontColor.Init(D3DCOLOR_ARGB(255, 0, 0, 0));
    }

    pElement = g_TheBlackWinnerDialog.GetDefaultElement(DXUT_CONTROL_STATIC, 0);
    g_TheBlackWinnerDialog.SetSize(500, 100);
    g_TheBlackWinnerDialog.SetBackgroundColors(D3DCOLOR_ARGB(0, 16, 16, 16), D3DCOLOR_ARGB(0, 16, 16, 16),
                                            D3DCOLOR_ARGB(0, 16, 16, 16), D3DCOLOR_ARGB(0, 16, 16, 16));
    g_TheBlackWinnerDialog.SetCallback(OnGUIEvent);
    g_TheBlackWinnerDialog.SetFont(0, L"Arial", 60, FW_BOLD);
    g_TheBlackWinnerDialog.AddStatic(IDC_THE_BLACK_WINNER_DIALOG, L"2", 0, 0, g_TheBlackWinnerDialog.GetWidth(),
                                  g_TheBlackWinnerDialog.GetHeight(), false, &pStatic);
}
开发者ID:Bastila,项目名称:c-plus-plus-examples,代码行数:80,代码来源:NsRenju.cpp


注:本文中的CDXUTDialog::GetWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。