void RenderSystem::v_Render() { BeginScene(); TurnOnAlphaBlending(); static float t = 0.0f; static ULONGLONG timeStart = 0; ULONGLONG timeCur = GetTickCount64(); if ( timeStart==0 ) timeStart = timeCur; t = ( timeCur-timeStart ) / 1000.0f; XMMATRIX Model = XMMatrixRotationY(t); XMStoreFloat4x4(&m_Matrix.model, XMMatrixTranspose(Model)); m_Cube.Render(m_pD3D11DeviceContext.Get(), m_Matrix); TurnOffAlphaBlending(); EndScene(); }
////Text bool ModelsDemo::RenderPassTwo(){ d3dContext_->OMSetRenderTargets( 1, &backBufferTarget_, NULL ); unsigned int stride = sizeof( VertexPos ); unsigned int offset = 0; // create matrices to create a single world matrix for the GameObject's transform XMMATRIX scale_mat = XMMatrixScaling(1,1,1); XMMATRIX rotation_mat = XMMatrixRotationRollPitchYaw(0,0,0); XMMATRIX position_mat = XMMatrixTranslation(0, 0, 0); XMMATRIX world_mat = XMMatrixTranspose( scale_mat * rotation_mat * position_mat ); d3dContext_->UpdateSubresource( worldCB_, 0, 0, &world_mat, 0, 0 ); d3dContext_->VSSetConstantBuffers( 0, 1, &worldCB_ ); TurnZBufferOff(); TurnOnAlphaBlending(); stride = sizeof( TextVertexPos ); offset = 0; d3dContext_->IASetInputLayout( textInputLayout_ ); d3dContext_->IASetVertexBuffers( 0, 1, &textVertexBuffer_, &stride, &offset ); d3dContext_->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST ); d3dContext_->VSSetShader( textTextureMapVS_, 0, 0 ); d3dContext_->PSSetShader( textTextureMapPS_, 0, 0 ); d3dContext_->PSSetShaderResources( 0, 1, &textColorMap_ ); d3dContext_->PSSetSamplers( 0, 1, &textColorMapSampler_ ); //////////////////////////////////////////////////////// //MyGrid->Render(d3dContext_); d3dContext_->IASetVertexBuffers( 0, 1, &textVertexBuffer_, &stride, &offset );/////// if (gameState_ == START_MENU) { /////////////////////////////////////////////TEXT////////////////////////////////////////////// DrawString( "PRESS SPACE to START", -0.4f, 0.0f ); DrawString( "PRESS ESC to QUIT", -0.35f, -0.1f ); //////////////////////////////////////////////////////////////////////////////////////////////// } char output[24]; if(gameState_ == RUN){ sprintf_s(output, "Floor:%d",MyGrid->GetFloorNumber()); DrawString( output, -0.1f, 0.8f); sprintf_s(output, "%d/%d",MyGrid->GetHealth(), MyGrid->GetMaxHealth()); DrawString( output, -0.1f, 0.9f); sprintf_s(output, "%d",MyGrid->GetPotions()); DrawString( output, -0.2f, 0.8f); sprintf_s(output, "%d",MyGrid->GetStrength()); DrawString( output, -0.3f, 0.8f); sprintf_s(output, "%d",MyGrid->GetDefense()); DrawString( output, -0.4f, 0.8f); } if((gameState_ == RUN)&&(displayFPS==true)) { /////////////////////////////////////////////TEXT////////////////////////////////////////////// //sprintf_s(output, "FPS:%d",fps_); sprintf_s(output, "FPS:%d",fps_); DrawString( output, -0.9f, 0.83f); //sprintf_s(output, "Frame Time:%d", MyGrid->GetHeight()); //DrawString( output, -0.9f, 0.6f); //////////////////////////////////////////////////////////////////////////////////////////////// } if (gameState_ == PAUSED) { /////////////////////////////////////////////TEXT////////////////////////////////////////////// DrawString( "GAME PAUSED", -0.2f, 0.0f ); if (pauseMenuSelection == RETURN) { DrawString( "->Return to Game<-", -0.33f, -0.1f ); } else { DrawString( "Return to Game", -0.25f, -0.1f ); } if (pauseMenuSelection == FPS) { if(displayFPS==true) { DrawString( "->Display FPS: ON<-",-0.35f, -0.2f ); } else { DrawString( "->Display FPS:OFF<-",-0.35f, -0.2f ); } } else { if(displayFPS==true) { DrawString( "Display FPS: ON",-0.27f, -0.2f ); } else { DrawString( "Display FPS:OFF",-0.27f, -0.2f ); } } if (pauseMenuSelection == PLAY_MOVIE) { DrawString( "->Play the Movie<-", -0.33f, -0.3f ); } else { DrawString( "Play the Movie", -0.25f, -0.3f ); } if (pauseMenuSelection == QUIT) { DrawString( "->Return to Menu<-", -0.33f, -0.4f ); } else { DrawString( "Return to Menu", -0.25f, -0.4f ); } //////////////////////////////////////////////////////////////////////////////////////////////// } TurnOffAlphaBlending(); TurnZBufferOn(); return true; }