本文整理汇总了C++中D3DCOLOR_ARGB函数的典型用法代码示例。如果您正苦于以下问题:C++ D3DCOLOR_ARGB函数的具体用法?C++ D3DCOLOR_ARGB怎么用?C++ D3DCOLOR_ARGB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了D3DCOLOR_ARGB函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: D3DCOLOR_ARGB
void CStarField::Init()
{
StarVertex_t StarVertex;
m_nWidth = m_pGameEngine->GetViewportWidth();
m_nHeight = m_pGameEngine->GetViewportHeight();
m_VecStars.clear();
// Generate star field data
for( int i=0; i < STARFIELD_STAR_COUNT; ++i )
{
int32 nRand = (rand()%(255-50))+50; //value between 50 and 255 for shades of gray
StarVertex.color = D3DCOLOR_ARGB( 255, nRand, nRand, nRand );
StarVertex.x = (float)(rand()%m_nWidth);
StarVertex.y = (float)(rand()%m_nHeight);
m_VecStars.push_back( StarVertex );
// bugbug jmccaskey - sometimes make "big stars" which are 4 points right next to each other?
}
}
示例2: menu_display_d3d9_clear_color
static void menu_display_d3d9_clear_color(
menu_display_ctx_clearcolor_t *clearcolor, video_frame_info_t *video_info)
{
LPDIRECT3DDEVICE9 dev;
DWORD clear_color = 0;
d3d9_video_t *d3d = video_info ?
(d3d9_video_t*)video_info->userdata : NULL;
if (!d3d || !clearcolor)
return;
dev = (LPDIRECT3DDEVICE9)d3d->dev;
clear_color = D3DCOLOR_ARGB(
BYTE_CLAMP(clearcolor->a * 255.0f), /* A */
BYTE_CLAMP(clearcolor->r * 255.0f), /* R */
BYTE_CLAMP(clearcolor->g * 255.0f), /* G */
BYTE_CLAMP(clearcolor->b * 255.0f) /* B */
);
d3d9_clear(dev, 0, NULL, D3D_COMM_CLEAR_TARGET, clear_color, 0, 0);
}
示例3: UpdateScreenResolution
void CGraphics::Initialize(IDirect3D9* pDirect3D, IDirect3DDevice9* pDevice)
{
m_pDevice = pDevice;
m_pDirect3D = pDirect3D;
m_bCursorEnabled = false;
UpdateScreenResolution();
CLog::Write("CGraphics::Initialize");
int width = GetSystemMetrics(SM_CXSCREEN);
int height = GetSystemMetrics(SM_CYSCREEN);
logo = new Sprite((float)width / 2, (float)height / 2);
CLog::Write("Width: %d Height: %d", width, height);
if (!logo->Init(pDevice, IDB_PNG1, 311, 152))
{
CLog::Write("Couldn't load the SA-MP+ logo");
}
else
{
//logo->Resize(311, 152);
//logo->Rotate(50);
CLog::Write("Loaded the SA-MP+ logo successfully");
}
box = new Box();
if (!box->Init(pDevice, 100, 100, width / 2, height / 2, D3DCOLOR_ARGB(55, 255, 255, 255)))
{
CLog::Write("Couldn't load 'box'");
}
else
{
CLog::Write("Loaded 'box'");
}
}
示例4: Direct3DSetupVertices
static void Direct3DSetupVertices(CUSTOMVERTEX *vertices,
const RECT src_full,
const RECT src_crop,
const RECT dst,
int alpha)
{
const float src_full_width = src_full.right - src_full.left;
const float src_full_height = src_full.bottom - src_full.top;
vertices[0].x = dst.left;
vertices[0].y = dst.top;
vertices[0].tu = src_crop.left / src_full_width;
vertices[0].tv = src_crop.top / src_full_height;
vertices[1].x = dst.right;
vertices[1].y = dst.top;
vertices[1].tu = src_crop.right / src_full_width;
vertices[1].tv = src_crop.top / src_full_height;
vertices[2].x = dst.right;
vertices[2].y = dst.bottom;
vertices[2].tu = src_crop.right / src_full_width;
vertices[2].tv = src_crop.bottom / src_full_height;
vertices[3].x = dst.left;
vertices[3].y = dst.bottom;
vertices[3].tu = src_crop.left / src_full_width;
vertices[3].tv = src_crop.bottom / src_full_height;
for (int i = 0; i < 4; i++) {
/* -0.5f is a "feature" of DirectX and it seems to apply to Direct3d also */
/* http://www.sjbrown.co.uk/2003/05/01/fix-directx-rasterisation/ */
vertices[i].x -= 0.5;
vertices[i].y -= 0.5;
vertices[i].z = 0.0f;
vertices[i].rhw = 1.0f;
vertices[i].diffuse = D3DCOLOR_ARGB(alpha, 255, 255, 255);
}
}
示例5: __Vector3
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CN3Camera::CN3Camera()
{
m_dwType |= OBJ_CAMERA;
m_Data.Release();
m_Data.vEye = m_vPos = __Vector3(15,5,-15);
m_Data.vAt = m_vAt = __Vector3(0,0,0);
m_Data.vUp = m_vScale = __Vector3(0,1,0);
m_Data.fFOV = D3DXToRadian(55.0f); // 기본값 55 도
m_Data.fNP = 0.7f;
m_Data.fFP = 512.0f;
m_bFogUse = TRUE;
m_FogColor = D3DCOLOR_ARGB(255,255,255,255);
// m_fFogDensity = 1.0 / m_Data.fFP;
// m_fFogStart = m_Data.fFP * 0.75f;
// m_fFogEnd = m_Data.fFP;
m_fRadianX = 0.0f;
m_bOrtho = false;
}
示例6: getCorner
void CAxisAlgnBB::render(int argb)
{
SVertex verts[kNumCorners];
WORD indexList[kMaxIndices] = { 0, 2, 3,
3, 1, 0,
7, 6, 4,
4, 5, 7,
4, 6, 2,
2, 0, 4,
1, 3, 7,
7, 5, 1,
4, 0, 1,
1, 5, 4,
2, 6, 7,
7, 3, 2
};
// Fill in the 8 vertices
for(int i = 0; i < kNumCorners; ++i)
{
CPos pos = getCorner(i);
verts[i].x = pos.x;
verts[i].y = pos.y;
verts[i].z = pos.z;
verts[i].color = argb;
}
// Render the AABB
g3D->render(verts, kNumCorners, indexList, kMaxIndices);
// Render lines on the top and bottom of the the front and
// back sides of the box. This allow us to see the full dimensions
// of the AABB better.
for(int i = 0; i < kNumCorners; ++i)
verts[i].color = D3DCOLOR_ARGB(255, 255, 255, 255);
g3D->renderLine(verts, kNumCorners);
}
示例7: _CreateFont
/// <summary>Draws a rectangle to the screen at the specified coordinates
/// with the given width, height and color.</summary>
/// <param name="pDevice">LPDIRECT3DDEVICE9 to render to.</param>
/// <param name="x">Screen X coordinate to draw to.</param>
/// <param name="y">Screen Y coordinate to draw to.</param>
/// <param name="width">Width of the rectangle.</param>
/// <param name="height">Height of the rectangle.</param>
/// <param name="alpha">Alpha level for the rectangle (transparency).</param>
/// <param name="r">Red color component for the colour of the rectangle.</param>
/// <param name="g">Green color component for the colour of the rectangle.</param>
/// <param name="b">Blue color component for the colour of the rectangle.</param>
bool D3DDisplayManager::DrawRectToScreen(LPDIRECT3DDEVICE9 pDevice, float x,
float y, float width, float height, int alpha, int r, int g, int b) {
_CreateFont(pDevice);
D3DCOLOR rectColor = D3DCOLOR_ARGB(alpha, r, g, b);
pLine->SetWidth(width);
// Draw a line with the thickness of width / 2 to get the desired width
D3DXVECTOR2 vLine[2];
vLine[0].x = x + width / 2;
vLine[0].y = y;
vLine[1].x = x + width / 2;
vLine[1].y = y + height;
pLine->Begin();
pLine->Draw(vLine, 2, rectColor);
pLine->End();
return true;
}
示例8: OnD3D9FrameRender
//--------------------------------------------------------------------------------------
// Render the scene using the D3D9 device
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D9FrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
{
HRESULT hr = S_OK;
// If the settings dialog is being shown, then render it instead of rendering the app's scene
if( g_SettingsDlg.IsActive() )
{
g_SettingsDlg.OnRender( fElapsedTime );
return;
}
D3DXMATRIX mWorld = *g_Camera.GetWorldMatrix();
D3DXMATRIX mView = *g_Camera.GetViewMatrix();
D3DXMATRIX mProj = *g_Camera.GetProjMatrix();
D3DXMATRIX mWorldViewProjection = mWorld * mView * mProj;
// Clear the render target and the zbuffer
V( pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB( 0, 160, 160, 250 ), 1.0f, 0 ) );
// Render the scene
if( SUCCEEDED( pd3dDevice->BeginScene() ) )
{
g_pEffect9->SetMatrix( g_hmWorld, &mWorld );
g_pEffect9->SetMatrix( g_hmWorldViewProjection, &mWorldViewProjection );
g_pEffect9->SetTexture( g_htxDiffuse, g_pTexture9 );
pd3dDevice->SetVertexDeclaration( g_pDecl9 );
g_Mesh.Render( pd3dDevice, g_pEffect9, g_hRenderScene );
DXUT_BeginPerfEvent( DXUT_PERFEVENTCOLOR, L"HUD / Stats" ); // These events are to help PIX identify what the code is doing
RenderText();
V( g_HUD.OnRender( fElapsedTime ) );
V( g_SampleUI.OnRender( fElapsedTime ) );
DXUT_EndPerfEvent();
V( pd3dDevice->EndScene() );
}
}
示例9: D3DCOLOR_ARGB
//-------------------------------------------------------------
// Name: RenderText()
// Desc: 상태와 도움말을 화면에 출력
//-------------------------------------------------------------
HRESULT CMyD3DApplication::RenderText()
{
D3DCOLOR fontColor = D3DCOLOR_ARGB(255,255,255,0);
TCHAR szMsg[MAX_PATH] = TEXT("");
FLOAT fNextLine = 40.0f; // 출력높이
// 화면상태
fNextLine = (FLOAT) m_d3dsdBackBuffer.Height;
lstrcpy( szMsg, TEXT("Press 'F2' to configure display") );
fNextLine -= 20.0f;
m_pFont->DrawText( 2, fNextLine, fontColor, szMsg );
lstrcpy( szMsg, m_strDeviceStats );
fNextLine -= 20.0f;
m_pFont->DrawText( 2, fNextLine, fontColor, szMsg );
lstrcpy( szMsg, m_strFrameStats );
fNextLine -= 20.0f;
m_pFont->DrawText( 2, fNextLine, fontColor, szMsg );
return S_OK;
}
示例10: spriter
GameScene::GameScene() : spriter(NULL), balloonTexture(NULL), backGroundTexture(NULL),
life(200), currentScore(0), currentEnemyNum(0), currentStage(1), prevTimer(0)
{
//배경위치 초기화
//position.x=0;
//position.y=0;
//position.z=0;
//vecPosBG.x = 0;
//vecPosBG.y = 0;
//vecPosBG.z = 0;
//vecPosition.x = SCREEN_WIDTH/2;
//vecPosition.y = SCREEN_HEIGHT/8;
//vecPosition.z = 0;
color = D3DCOLOR_ARGB(255,255,255,255);
background = _T("..\\Resource\\bird_test\\background.png");
SetSceneNumber(GAME_SCENE);
//ZeroMemory(&om, sizeof(ObjectManager));
//om = new ObjectManager;
//startTime = 0;
//goalTime = 0;
}
示例11: D3DCOLOR_ARGB
CEffAttack001::CEffAttack001( CResBattle *game, CShanaProt *target ):CSprite( game )
{
// 資源調達
m_Anime.m_AnimeSpec = game->m_AnimationManager->GetAnimation( ANIME_NO_EFF_ATTACK_001 );
m_Tex = game->m_TextureManager->GetTextureGroup( TEXTURE_NO_EFF_SHA408 );
m_DispObjGroup = m_Game->m_DispObjGroup;
m_DispObj = m_DispObjGroup->GetDispObj();
/* m_Anime.m_AnimeSpec->CreateAction( 0, 10 );
m_Anime.m_AnimeSpec->GetActionData( 0 )->SetMotionData( 0, 0, 4, 320, 240 );
m_Anime.m_AnimeSpec->GetActionData( 0 )->SetMotionData( 1, 1, 4, 320, 240 );
m_Anime.m_AnimeSpec->GetActionData( 0 )->SetMotionData( 2, 2, 4, 320, 240 );
m_Anime.m_AnimeSpec->GetActionData( 0 )->SetMotionData( 3, 3, 4, 320, 240 );
m_Anime.m_AnimeSpec->GetActionData( 0 )->SetMotionData( 4, 4, 4, 320, 240 );
m_Anime.m_AnimeSpec->GetActionData( 0 )->SetMotionData( 5, 5, 4, 320, 240 );
m_Anime.m_AnimeSpec->GetActionData( 0 )->SetMotionData( 6, 6, 4, 320, 240 );
m_Anime.m_AnimeSpec->GetActionData( 0 )->SetMotionData( 7, 7, 4, 320, 240 );
m_Anime.m_AnimeSpec->GetActionData( 0 )->SetMotionData( 8, 8, 4, 320, 240 );
m_Anime.m_AnimeSpec->GetActionData( 0 )->SetMotionData( 9, 9, 0, 320, 240 );
*/
// game->m_AnimationManager->SetupAnimation( m_Anime, 0 );
// game->m_TextureManager->SetupTextureGroup( m_Tex, 0 );
// 初期状態
target->GetPosition( &m_X, &m_Y );
m_Dir = target->getDir();
m_X -= m_Dir * 118;
m_Y -= 70;
m_Flame = 0;
// ブレンド方法指定
m_DispObj->SetDestBlend(D3DBLEND_ONE);
m_DispObj->SetSrcBlend(D3DBLEND_ONE);
m_DispObj->SetBlendColor( D3DCOLOR_ARGB(255,255,255,255) );
// ランダム回転
// m_DispObj->SetRotation( 0,0,0,0, 1, ( rand()%360 ));
}
示例12: m_pDevice
C3DVertex::C3DVertex(LPDIRECT3DDEVICE9 _pDevice, float z) : m_pDevice(_pDevice),m_alpha(255)
{
m_color = D3DCOLOR_ARGB(m_alpha,255,255,255);
// 板ポリゴン作成
if ( FAILED( m_pDevice->CreateVertexBuffer( sizeof( CUSTOMVERTEX ) * 4, 0, D3DFVF_CUSTOM3DVERTEX, D3DPOOL_MANAGED, &m_vertex, 0 ) ) ) {
return ;
}
CUSTOMVERTEX billboard[ 4 ] = {
{ D3DXVECTOR3( -0.5f, -0.5f, z ), 0.0f, 1.0f },
{ D3DXVECTOR3( -0.5f, 0.5f, z ), 0.0f, 0.0f },
{ D3DXVECTOR3( 0.5f, -0.5f, z ), 1.0f, 1.0f },
{ D3DXVECTOR3( 0.5f, 0.5f, z ), 1.0f, 0.0f }
};
CUSTOMVERTEX* p;
m_vertex->Lock( 0, 0, (void**)&p, 0 );
{
memcpy( p, billboard, sizeof( CUSTOMVERTEX ) * 4 );
m_vertex->Unlock();
}
}
示例13: D3DCOLOR_ARGB
////////////////////////////////////////////////////////////////
//
// CRenderItemManager::SaveReadableDepthBuffer
//
// Ensure our readable depth buffer is no longer being used
//
////////////////////////////////////////////////////////////////
void CRenderItemManager::SaveReadableDepthBuffer( void )
{
if ( m_bUsingReadableDepthBuffer )
{
m_bUsingReadableDepthBuffer = false;
if ( m_pNonAADepthSurface2 )
{
// If using AA hacks, change to the other depth buffer we created
m_pDevice->SetDepthStencilSurface ( m_pNonAADepthSurface2 );
m_pDevice->Clear ( 0, NULL, D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, D3DCOLOR_ARGB(0,0,0,0), 1, 0 );
}
else
{
// If not using AA hacks, just change back to the GTA depth buffer
if ( m_pSavedSceneDepthSurface )
{
m_pDevice->SetDepthStencilSurface ( m_pSavedSceneDepthSurface );
SAFE_RELEASE( m_pSavedSceneDepthSurface );
}
}
}
}
示例14: OnFrameRender
void CALLBACK OnFrameRender(IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext)
{
HRESULT hr;
V(pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(0, 33, 64, 145), 1.0f, 0));
if(SUCCEEDED(pd3dDevice->BeginScene()))
{
g_BackgroundQuad.Render();
g_Board.Render(pd3dDevice);
RenderArrows(fElapsedTime);
RenderWinner(fElapsedTime);
DXUT_BeginPerfEvent(DXUT_PERFEVENTCOLOR, L"HUD / Stats");
//RenderText();
V(g_HUD.OnRender(fElapsedTime));
V(g_SampleUI.OnRender(fElapsedTime));
DXUT_EndPerfEvent();
V(pd3dDevice->EndScene());
}
}
示例15: menu_iterate_xui
bool menu_iterate_xui(void)
{
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->d3d_render_device;
app.RunFrame(); /* Update XUI */
XuiRenderBegin( app.GetDC(), D3DCOLOR_ARGB( 255, 0, 0, 0 ) );
D3DXMATRIX matOrigView;
XuiRenderGetViewTransform( app.GetDC(), &matOrigView );
XUIMessage msg;
XUIMessageRender msgRender;
XuiMessageRender( &msg, &msgRender, app.GetDC(), 0xffffffff, XUI_BLEND_NORMAL );
XuiSendMessage( app.GetRootObj(), &msg );
XuiRenderSetViewTransform( app.GetDC(), &matOrigView );
XuiRenderEnd( app.GetDC() );
XuiTimersRun();
return true;
}