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? } }
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); }
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'"); } }
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); } }
////////////////////////////////////////////////////////////////////// // 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; }
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); }
/// <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; }
//-------------------------------------------------------------------------------------- // 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() ); } }
//------------------------------------------------------------- // 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; }
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; }
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 )); }
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(); } }
//////////////////////////////////////////////////////////////// // // 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 ); } } } }
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()); } }
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; }
//renders text with a given font HRESULT ZFXD3D::DrawText(UINT nID, int x, int y, UCHAR r, UCHAR g, UCHAR b, wchar_t *ch, ...) { RECT rc = { x, y, 0, 0 }; wchar_t cch[1024]; va_list pArgs; //put variables into the args string va_start(pArgs, ch); vswprintf_s(cch, 256, ch, pArgs); if (nID >= m_nNumFonts) { return ZFX_INVALIDPARAM; } //calculate size of the text m_pFont[nID]->DrawText(NULL, cch, -1, &rc, DT_SINGLELINE | DT_CALCRECT, 0); //now draw the text m_pFont[nID]->DrawText(NULL, cch, -1, &rc, DT_SINGLELINE, D3DCOLOR_ARGB(255, r, g, b)); return ZFX_OK; }
void Engine::Graphics::drawCursor(){ Cursor* c = Engine::Cursor::instance(); D3DXMATRIX transMat, scaleMat, rotMat, worldMat; D3DXMatrixIdentity(&transMat); D3DXMatrixIdentity(&scaleMat); D3DXMatrixIdentity(&rotMat); D3DXMatrixIdentity(&worldMat); D3DXMatrixScaling(&scaleMat, 1, 1, 1); D3DXMatrixTranslation(&transMat, c->cursorPos.x, c->cursorPos.y, 0); D3DXMatrixRotationYawPitchRoll(&rotMat, 0,0, 0); D3DXMatrixMultiply(&scaleMat, &scaleMat, &rotMat); D3DXMatrixMultiply(&worldMat, &scaleMat, &transMat); Engine::DX::instance()->getSprite()->SetTransform(&worldMat); Engine::DX::instance()->getSprite()->Draw( getTexture(c->getHandle()), 0, &dVec3(getInfo(c->getHandle()).Width *0.5f, getInfo(c->getHandle()).Height *0.5f, 0.0f), 0, D3DCOLOR_ARGB(255,255,255,255)); }
void CRenderer::EnableRenderTarget( const MGuiRendTarget* target, int32 x, int32 y ) { CRenderTarget* cache = (CRenderTarget*)target; if ( target == NULL ) return; d3dDevice->GetRenderTarget( 0, &cache->oldSurface ); if ( cache->oldSurface != cache->surface ) { d3dDevice->SetRenderTarget( 0, cache->surface ); d3dDevice->Clear( 0, 0, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 1.0f, 0 ); cache->oldCache = renderTarget; cache->oldX = drawOffsetX; cache->oldY = drawOffsetY; drawOffsetX = x; drawOffsetY = y; renderTarget = cache; return; } }
//-------------------------------------------------------------------------------------- // Render the scene using the D3D9 device //-------------------------------------------------------------------------------------- void CALLBACK OnD3D9FrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext ) { HRESULT hr; // 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; } // Clear the render target and the zbuffer V( pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB( 0, 0, 0, 0 ), 1.0f, 0 ) ); // Render the scene if( SUCCEEDED( pd3dDevice->BeginScene() ) ) { g_pMain->Render(); V( pd3dDevice->EndScene() ); } }
// 使用DirectX 9來繪圖 void RenderFrameDX9(void) { LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9(); // 消除畫面 device->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(0, 0, 0, 0), 1.0f, 0); // 開始下繪圖指令 device->BeginScene(); // 鏡頭座標系的轉換矩陣 Matrix4x4 view_matrix = GutMatrixLookAtRH(g_eye, g_lookat, g_up); device->SetTransform(D3DTS_VIEW, (D3DMATRIX *) &view_matrix); // device->SetTransform(D3DTS_WORLD, (D3DMATRIX *) &g_world_matrix); // 設定資料格式 device->SetFVF(D3DFVF_XYZ|D3DFVF_TEX1); // 套用貼圖 device->SetTexture(0, g_pTexture); // 畫出格子 device->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, g_Quad, sizeof(Vertex_VT)); // 宣告所有的繪圖指令都下完了 device->EndScene(); // 把背景backbuffer的畫面呈現出來 device->Present( NULL, NULL, NULL, NULL ); }
// `使用Direct3D9來繪圖` void RenderFrameDX9(void) { LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9(); // `消除畫面` device->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(0, 0, 0, 0), 1.9f, 0.7); // `開始下繪圖指令` device->BeginScene(); // `設定轉換矩陣` device->SetTransform(D3DTS_WORLD, (D3DMATRIX *) &g_world_matrix); // `設定資料格式` device->SetFVF(D3DFVF_XYZ|D3DFVF_TEX1); // `套用貼圖` device->SetTexture(0, g_pTexture); D3DTEXTUREADDRESS modes[] = { D3DTADDRESS_WRAP, D3DTADDRESS_MIRROR, D3DTADDRESS_CLAMP, D3DTADDRESS_BORDER }; device->SetSamplerState(0, D3DSAMP_BORDERCOLOR, 0x7f7f7f7f); // `畫出格子` for ( int i=0; i<4; i++ ) { // D3DSAMP_ADDRESSU `設定水平方向解讀模式` device->SetSamplerState(0, D3DSAMP_ADDRESSU, modes[i]); // D3DSAMP_ADDRESSV `設定垂直方向解讀模式`` device->SetSamplerState(0, D3DSAMP_ADDRESSV, modes[i]); device->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, g_Quads[i], sizeof(Vertex_VT)); } // `宣告所有的繪圖指令都下完了` device->EndScene(); // `把背景backbuffer的畫面呈現出來` device->Present( NULL, NULL, NULL, NULL ); }
void XSetItemInfomation::DrawSkillToolTip( int nGroup, int DrawX, int DrawY, SIZE TooltipSize, int &nCurrentDrawYModify, _ITEMTOOLTIP_INFO& TooltipInfo ) { map<int, SetInfo*>::iterator iter; iter = m_mpData.find( nGroup ); if( iter == m_mpData.end() ) return; SetInfo* pSetInfo = iter->second; //iter ¸¦ ÀÌÁßÀ¸·Î ½á¾ßÇÑ´Ù.. ½ºÅ³Àº ÀüºÎ Àû¿ëÀÌ µÇ¾ßÇϱ⶧¹®ÀÓ.. //¿Í,, º¸±â ¿¶ó ºÒÆíÇÏ´Ù.. list<ItemDetailInfo*>::iterator Detailiter = pSetInfo->ltItemInfo.begin(); //¾ÆÀÌÅÛ¼¼ºÎÁ¤º¸.. list<SkillInfo*>::iterator Skilliter; //¾ÆÀÌÅÛÁ¤º¸¾È¿¡ ½ºÅ³Á¤º¸ for(int i = 0; Detailiter != pSetInfo->ltItemInfo.end(); ++Detailiter) { for( Skilliter = (*Detailiter)->ltSkillInfo.begin(); Skilliter != (*Detailiter)->ltSkillInfo.end(); ++Skilliter ) { if((*Skilliter)->nSkillID > 0 ) // ½ºÅ³ ¾ÆÀ̵𰡠0 ÀÌ ¾Æ´Ï¸é.. { if( (*Detailiter)->nAccouteredItem > m_nAccouteredItem ) //Âø¿ëÇÑ °³¼ö°¡ ÃÊ°ú g_XBaseFont->SetColor(_XSC_DEFAULT); else g_XBaseFont->SetColor(D3DCOLOR_ARGB(255,3,253,62)); //ÁٹٲÞÀ» ÇÒ¼ö ÀÖ°Ô ¹Ù²ã¾ßÇÑ´Ù. 08/09/04 g_XBaseFont->Puts_Separate( DrawX, DrawY, TooltipInfo.SetItemSkill_Data_Buf[i], TooltipSize.cx - 16, 1.0f, 3 ); int templength = g_XBaseFont->GetRowCount( TooltipInfo.SetItemSkill_Data_Buf[i], TooltipSize.cx - 16 ); i++; DrawY = DrawY + (16 * templength); nCurrentDrawYModify = nCurrentDrawYModify + (16 * templength); //ÀÌ°Ç,,, µðÆúÆ® ÅøÆÁ¿¡ m_CurrentDrawPosY À̰ǵ¥,, ½ºÅ³ ¹Ø¿¡µµ ´Ù¸¥ ½ºÆ®¸µÀÌ ÀÖ¾î¼ À¯ÁöÇØ Áà¾ßÇÑ´Ù } } } }
//-------------------------------------------------------------------------------------- // Render the help and statistics text. This function uses the ID3DXFont interface for // efficient text rendering. //-------------------------------------------------------------------------------------- void RenderText() { // Output statistics g_pTxtHelper->Begin(); g_pTxtHelper->SetInsertionPos( 5, 5 ); g_pTxtHelper->SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1.0f ) ); g_pTxtHelper->DrawTextLine( DXUTGetFrameStats( DXUTIsVsyncEnabled() ) ); g_pTxtHelper->DrawTextLine( DXUTGetDeviceStats() ); g_pTxtHelper->SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f ) ); g_pTxtHelper->DrawTextLine( g_strFileSaveMessage ); // Draw help if( g_bShowHelp ) { UINT nBackBufferHeight = DXUTGetDXGIBackBufferSurfaceDesc()->Height; g_pTxtHelper->SetInsertionPos( 10, nBackBufferHeight - 15 * 5 ); g_pTxtHelper->SetForegroundColor( D3DCOLOR_ARGB( 200, 150, 150, 150 ) ); g_pTxtHelper->DrawTextLine( L"Controls (F1 to hide):" ); g_pTxtHelper->SetInsertionPos( 20, nBackBufferHeight - 15 * 4 ); g_pTxtHelper->DrawTextLine( L"Rotate model: Left mouse button\n" L"Rotate camera: Right mouse button\n" L"Zoom camera: Mouse wheel scroll\n" ); g_pTxtHelper->SetInsertionPos( 250, nBackBufferHeight - 15 * 4 ); g_pTxtHelper->DrawTextLine( L"Hide help: F1\n" ); g_pTxtHelper->DrawTextLine( L"Quit: ESC\n" ); } else { g_pTxtHelper->SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f ) ); g_pTxtHelper->DrawTextLine( L"Press F1 for help" ); } g_pTxtHelper->End(); }
void CTListBox::Draw() { if(!IsVision() || m_pFontMgr == NULL || m_bOwnerDraw ) return ; int iValue = GetValue();///첫번째 찍을 라인 int iExtent = GetExtent();///화면에 보여줄수 있는 최대 라인수 if( iValue + iExtent >= (int)m_ITM.size() )///리스트의 최대범위밖으로 안나가도록 수정 iExtent = (int)m_ITM.size() - iValue; m_pFontMgr->SetTransformSprite( (float)m_sPosition.x, (float)m_sPosition.y ); D3DCOLOR dwColor ; int iPosY = 0 ; for( int i = iValue; i < iValue + iExtent ; ++i ) { if( i >= (int)m_ITM.size() || i < 0 ) break; if( m_iSelectedItem == i ) dwColor = D3DCOLOR_ARGB( 255, 255, 128, 0); else dwColor = m_ITM[i].m_dwColor; if( m_ITM[i].m_szTxt ) { m_ITM[i].m_bDrawn = true; if( strlen( m_ITM[i].m_szTxt ) > 0 ) m_pFontMgr->Draw( m_iFont, true, 0, iPosY, dwColor, m_ITM[i].m_szTxt ); else m_pFontMgr->Draw( m_iFont, true, 0, iPosY, dwColor, " " ); iPosY += m_iCharHeight + m_iLineSpace; } } }
void _XWindow_Pocket::DrawSelectedItem(void) { RECT iconrect; int selectedslot = SearchSlotIndex(); iconrect.left = m_WindowPosition.x + m_SlotPosition[selectedslot].x; iconrect.top = m_WindowPosition.y + m_SlotPosition[selectedslot].y; iconrect.right = m_WindowPosition.x + m_SlotPosition[selectedslot].x + 31; iconrect.bottom = m_WindowPosition.y + m_SlotPosition[selectedslot].y + 31; if(selectedslot != -1) { if(g_pInventory_Window->m_bHaveMouseSlot) { _XDrawRectAngle(iconrect.left, iconrect.top, iconrect.right, iconrect.bottom, 1.0f, _XSC_WARNING ); } // mouse hover if( m_AccessoryItemList[selectedslot].Get_m_sID() > 0 ) _XDrawRectAngle(iconrect.left, iconrect.top, iconrect.right, iconrect.bottom, 1.0f, _XSC_ITEM_CLICK); } if( m_MouseSlotItem.m_InventoryNumber >= 0 ) { iconrect.left = m_WindowPosition.x+m_SlotPosition[m_MouseSlotItem.m_InventoryNumber].x; iconrect.top = m_WindowPosition.y+m_SlotPosition[m_MouseSlotItem.m_InventoryNumber].y; iconrect.right = m_WindowPosition.x+m_SlotPosition[m_MouseSlotItem.m_InventoryNumber].x + 31; iconrect.bottom = m_WindowPosition.y+m_SlotPosition[m_MouseSlotItem.m_InventoryNumber].y + 31; if(m_bHaveMouseSlot) { // disable icon image _XDrawSolidBar(iconrect.left, iconrect.top, iconrect.right, iconrect.bottom, D3DCOLOR_ARGB(160, 0, 0, 0)); } _XDrawRectAngle( iconrect.left, iconrect.top, iconrect.right, iconrect.bottom, 1.0f, _XSC_ITEM_SELECT ); } }
D3DCOLOR CGameBase::GetIDColorByLevelDifference(int iLevelDiff) { // 레벨 차이에 따른 색깔... // 보라색 : 플레이어보다 +8, // 빨간색: 플레이어보다 +5, +6, +7 // 노란색 : 플레이어어보다 +2, +3, +4 // 흰색 : -1 ? 플레이어 ? 1 // 파란색 : 플레이어보다 2레벨 이하 -2, -3, -4 // 초록색 : 플레이어보다 -5, -6, -7 // 하늘색 : 플레이어보다 -8, …(경험치를 얻지 못함) D3DCOLOR crID = 0xffffffff; if(iLevelDiff >= 8) crID = D3DCOLOR_ARGB(255, 255, 0, 255); else if(iLevelDiff >= 5) crID = D3DCOLOR_ARGB(255, 255, 0, 0); else if(iLevelDiff >= 2) crID = D3DCOLOR_ARGB(255, 255, 255, 0); else if(iLevelDiff >= -1) crID = D3DCOLOR_ARGB(255, 255, 255, 255); else if(iLevelDiff >= -4) crID = D3DCOLOR_ARGB(255, 0, 0, 255); else if(iLevelDiff >= -7) crID = D3DCOLOR_ARGB(255, 0, 255, 0); else crID = D3DCOLOR_ARGB(255, 0, 255, 255); return crID; }
ElTerrain::ElTerrain() : mLod(true) , mNumTilePerSide(0) , mSideLengthScalar(1.0f) , mHeightScalar(2.0f) , mBaseHeight(0.0f) , mNumVertexPerSide(0) , mSlopeNormalFactor(4.5f) , mTopLod(0) , mLodFactor1(4.0f) , mLodFactor2(2.5f) , mNumVertex(0) , mNumMaxIndex(0) , mNumIndex(0) , mVertexDeclaration(NULL) , mVertexBuffer(NULL) , mIndexBuffer(NULL) , mQuadTree(NULL) , mDiffuse(NULL) , mAmbient(D3DCOLOR_ARGB(255, 255, 255, 255)) , mShader(NULL) { memset((void*)mTexture, NULL, sizeof(mTexture)); }
//------------------------------------------------------------------------------- int CMaterialManager::SetDefaultTexture(IDirect3DTexture9** p_ppiOut) { if (sDefaultTexture) { sDefaultTexture->AddRef(); *p_ppiOut = sDefaultTexture; return 1; } if(FAILED(g_piDevice->CreateTexture( 256, 256, 0, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, p_ppiOut, NULL))) { CLogDisplay::Instance().AddEntry("[ERROR] Unable to create default texture", D3DCOLOR_ARGB(0xFF,0xFF,0,0)); *p_ppiOut = NULL; return 0; } D3DXFillTexture(*p_ppiOut,&FillFunc,NULL); sDefaultTexture = *p_ppiOut; sDefaultTexture->AddRef(); // {9785DA94-1D96-426b-B3CB-BADC36347F5E} static const GUID guidPrivateData = { 0x9785da94, 0x1d96, 0x426b, { 0xb3, 0xcb, 0xba, 0xdc, 0x36, 0x34, 0x7f, 0x5e } }; uint32_t iData = 0xFFFFFFFF; (*p_ppiOut)->SetPrivateData(guidPrivateData,&iData,4,0); return 1; }
void Bullet::Render() { D3DCOLOR color; color = D3DCOLOR_ARGB(255,255,255,255); for(int i=0;i<20;i++) { if(Moving[i] == true) { m_pSprite->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE); m_pSprite->Draw(m_Texture.GetTexture(),&m_rect[i],NULL,&m_vPos[i],color); m_pSprite->End(); } if(Explo[i] == true) { m_pSprite->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE); m_pSprite->Draw(m_Texture.GetTexture(),&Explo_rect[i],NULL,&Explo_vPos[i],color); m_pSprite->End(); } } }
bool RenderingDevice::BeginFrame() { if (mBeginSceneDepth++ > 0) { return true; } auto clearColor = D3DCOLOR_ARGB(0, 0, 0, 0); auto result = D3DLOG(mDevice->Clear(0, nullptr, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, clearColor, 1.0f, 0)); if (result != D3D_OK) { return false; } result = D3DLOG(mDevice->BeginScene()); if (result != D3D_OK) { return false; } mLastFrameStart = Clock::now(); return true; }