void ColoredCubeApp::drawScene() { D3DApp::drawScene(); // Restore default states, input layout and primitive topology // because mFont->DrawText changes them. Note that we can // restore the default states by passing null. md3dDevice->OMSetDepthStencilState(0, 0); float blendFactors[] = {0.0f, 0.0f, 0.0f, 0.0f}; md3dDevice->OMSetBlendState(0, blendFactors, 0xffffffff); md3dDevice->IASetInputLayout(mVertexLayout); D3DXVECTOR3 pos(0.0f,45.0f,-50.0f); // set lighting shader variables mfxEyePosVar->SetRawValue(&pos, 0, sizeof(Vector3)); mfxLightVar->SetRawValue(&lights[0], 0, sizeof(Light)); mfxLightType->SetInt(lightType); // set some variables for the shader // set the point to the shader technique D3D10_TECHNIQUE_DESC techDesc; mTech->GetDesc(&techDesc); //setting the color flip variable in the shader //draw the floor floor.draw(mView, mProj, mfxWVPVar, mfxWorldVar, mTech); ////// New Stuff added by Steve ////// mWVP = player.getWorldMatrix() *mView*mProj; mfxWVPVar->SetMatrix((float*)&mWVP); mfxWorldVar->SetMatrix((float*)&player.getWorldMatrix()); player.setMTech(mTech); player.draw(); for (int i = 0; i < numberOfObstacles; i++) { mWVP = obstacles[i].getWorldMatrix() * mView * mProj; mfxWVPVar->SetMatrix((float*)&mWVP); mfxWorldVar->SetMatrix((float*)&obstacles[i].getWorldMatrix()); obstacles[i].setMTech(mTech); obstacles[i].draw(); } //Spectrum HUD for(int i = 0; i < 6; i++) { D3DXMATRIX a; D3DXMatrixRotationY(&a, 1.573f); mWVP = a * spectrum[i].getWorldMatrix() * mView * mProj; mfxWVPVar->SetMatrix((float*)&mWVP); mfxWorldVar->SetMatrix((float*)&spectrum[i].getWorldMatrix()); spectrum[i].setMTech(mTech); spectrum[i].draw(); } mWVP = cursor.getWorldMatrix() * mView * mProj; mfxWVPVar->SetMatrix((float*)&mWVP); mfxWorldVar->SetMatrix((float*)&cursor.getWorldMatrix()); cursor.setMTech(mTech); cursor.draw(); ////////////////////////////////////// /////Text Drawing Section // We specify DT_NOCLIP, so we do not care about width/height of the rect. RECT R = {5, 5, 0, 0}; RECT R1 = {0, 0, 800, 600}; RECT R2 = {0, 540, 800, 600}; std::wostringstream outs; outs.precision(6); string Hud = score.getString(); /*outs << score.getString() << L"\n"; outs << L"Blobs Available: " << ammo << L"\n"; outs << L"Gallons Left: " << lives; std::wstring text = outs.str(); mFont->DrawText(0, text.c_str(), -1, &R, DT_NOCLIP, BLACK);*/ timesNew.draw(Hud, Vector2(5, 5)); if (gameOver) { mFont->DrawText(0, L"Game Over!", -1, &R1, DT_CENTER | DT_VCENTER, BLACK); } float gameTime = mTimer.getGameTime(); if (gameTime < 3.0f) { mFont->DrawText(0, L"Move your Box LEFT and RIGHT with A & D to avoid hitting the obstacles", -1, &R2, DT_CENTER | DT_VCENTER, BLACK); } else if (gameTime < 6.0f) { mFont->DrawText(0, L"Change the color of your Box by pressing the J and L keys.", -1, &R2, DT_CENTER | DT_VCENTER, BLACK); } else if (gameTime < 9.0f) { mFont->DrawText(0, L"The closer the color of your cube is to the floor, the higher the score multiplier!", -1, &R2, DT_CENTER | DT_VCENTER, BLACK); } if (activeMessage) { mFont->DrawText(0, message.c_str(), -1, &R2, DT_CENTER | DT_VCENTER, BLACK); } mSwapChain->Present(0, 0); }