void CAnimationInstance::DrawFrames( D3DXFRAME_ANIM * pFrame) { if( pFrame->pMeshContainer) DrawMeshFrame( pFrame); if( pFrame->pFrameSibling) DrawFrames( (D3DXFRAME_ANIM *)pFrame->pFrameSibling); if( pFrame->pFrameFirstChild) DrawFrames( (D3DXFRAME_ANIM *) pFrame->pFrameFirstChild); }
static char Input (char* Prompt, char* Buf, unsigned char Count) /* Read input from the user, return 1 on success, 0 if aborted */ { int Frame; unsigned char OldColor; unsigned char OldCursor; unsigned char x1; unsigned char i; unsigned char done; char c; /* Clear the current prompt line */ cclearxy (0, MAX_Y-1, MAX_X); /* Display the new prompt */ OldColor = textcolor (COLOR_TEXTHIGH); cputsxy (0, MAX_Y-1, Prompt); (void) textcolor (COLOR_TEXTLOW); /* Remember where we are, enable the cursor */ x1 = wherex (); OldCursor = cursor (1); /* Get input and handle it */ i = done = 0; do { c = cgetc (); if (isalnum (c) && i < Count) { Buf [i] = c; cputcxy (x1 + i, MAX_Y-1, c); ++i; } else if (i > 0 && c == CH_DEL) { --i; cputcxy (x1 + i, MAX_Y-1, ' '); gotoxy (x1 + i, MAX_Y-1); } else if (c == '\n') { Buf [i] = '\0'; done = 1; } else if (IsAbortKey (c)) { /* Abort */ done = 2; } } while (!done); /* Reset settings, display old prompt line */ cursor (OldCursor); (void) textcolor (OldColor); DrawFrames (); Frame = ActiveFrame; ActiveFrame = -1; ActivateFrame (Frame, 0); return (done == 1); }
static void RedrawStatic (char Frame) /* Redraw static display stuff */ { /* Reset the active frame */ ActiveFrame = -1; /* Clear the screen hide the cursor */ (void) bordercolor (COLOR_BORDER); (void) bgcolor (COLOR_BACKGROUND); clrscr (); cursor (0); /* Build the frame layout of the screen */ (void) textcolor (COLOR_FRAMELOW); DrawFrames (); /* Draw the prompt line */ HelpPrompt (); /* Activate the active frame */ ActivateFrame (Frame, 0); }
void CAnimationInstance::Draw(void) { DrawFrames( (D3DXFRAME_ANIM *)m_pAnimatedMesh->m_pFrameRoot); }
//----------------------------------------------------------------------------- // Name: Render() // Desc: Called once per frame, the call is the entry point for 3d // rendering. This function sets up render states, clears the // viewport, and renders the scene. //----------------------------------------------------------------------------- HRESULT CMyD3DApplication::Render() { // Set up viewing postion from ArcBall SDrawElement *pdeCur; D3DXMATRIXA16 mat; pdeCur = m_pdeHead; while (pdeCur != NULL) { pdeCur->pframeRoot->matRot = *m_ArcBall.GetRotationMatrix(); pdeCur->pframeRoot->matTrans = *m_ArcBall.GetTranslationMatrix(); pdeCur = pdeCur->pdeNext; } // Clear the viewport m_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(89,135,179), 1.0f, 0 ); if (m_pdeHead == NULL) { return S_OK; } // Begin the scene if( SUCCEEDED( m_pd3dDevice->BeginScene() ) ) { UINT cTriangles = 0; HRESULT hr; SDrawElement *pdeCur; D3DXMATRIXA16 mCur; D3DXVECTOR3 vTemp; D3DXMatrixTranslation(&m_mView, 0, 0, -m_pdeSelected->fRadius * 2.8f); hr = m_pd3dDevice->SetTransform(D3DTS_VIEW, (D3DMATRIX*)&m_mView); if(FAILED(hr)) return hr; pdeCur = m_pdeHead; while (pdeCur != NULL) { D3DXMatrixIdentity(&mCur); hr = UpdateFrames(pdeCur->pframeRoot, mCur); if (FAILED(hr)) return hr; hr = DrawFrames(pdeCur->pframeRoot, cTriangles); if (FAILED(hr)) return hr; pdeCur = pdeCur->pdeNext; } // Show frame rate m_pFont->DrawText( 2, 0, D3DCOLOR_ARGB(255,255,255,0), m_strFrameStats ); m_pFont->DrawText( 2, 20, D3DCOLOR_ARGB(255,255,255,0), m_strDeviceStats ); // End the scene. m_pd3dDevice->EndScene(); } return S_OK; }