コード例 #1
0
ファイル: Sprite.cpp プロジェクト: KreXor/cpp-gameEngine
void Sprite::Draw(SDL_Rect *position, GameEngine *game, float gameTime, int direction)
{
	Animation* temp;
	temp = pAnimations->GetAnimation( current_behaviour );

	temp->Draw(position, game, gameTime, direction);
}
コード例 #2
0
ファイル: application.cpp プロジェクト: 7zhang/studies
void Application::Render() {
    if (!m_deviceLost) {
        try {
            //Create Matrices
            D3DXMATRIX identity, world, view, proj, shadow;
            D3DXMatrixIdentity(&identity);
            D3DXMatrixLookAtLH(&view, &D3DXVECTOR3(3.0f, 1.5f, 0.0f), &D3DXVECTOR3(0.0f, 1.0f, 0.0f), &D3DXVECTOR3(0.0f, 1.0f, 0.0f));
            D3DXMatrixPerspectiveFovLH(&proj, D3DX_PI / 4.0f, (float)WINDOW_WIDTH / (float)WINDOW_HEIGHT, 1.0f, 1000.0f);
            D3DXPLANE ground(0.0f, 1.0f, 0.0f, 0.0f);
            D3DXVECTOR4 lightPos(-50.0f, 75.0f, 50.0f, 0.0f);
            D3DXMatrixShadow(&shadow, &lightPos, &ground);

            g_pDevice->SetTransform(D3DTS_WORLD, &identity);
            g_pDevice->SetTransform(D3DTS_VIEW, &view);
            g_pDevice->SetTransform(D3DTS_PROJECTION, &proj);

            // Clear the viewport
            g_pDevice->Clear(0L, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0L);

            // Begin the scene
            if (SUCCEEDED(g_pDevice->BeginScene())) {
                m_animation.Draw();

                // End the scene.
                g_pDevice->EndScene();
                g_pDevice->Present(0, 0, 0, 0);
            }
        }
        catch(...) {
            g_debug << "Error in Application::Render() \n";
        }
    }
}