void CGLRenderer::DrawScene(CDC *pDC) { glClear(GL_COLOR_BUFFER_BIT); glDrawArrays(GL_TRIANGLES, 0, 6); FinishDrawing(); SwapBuffers(pDC->m_hDC); }
void UIDirect3D9Window::MainLoop(void) { quint64 timestamp = StartFrame(); CheckForNewTheme(); UpdateImages(); if (m_d3dDevice) { HRESULT result = m_d3dDevice->TestCooperativeLevel(); if (SUCCEEDED(result)) { m_d3dDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0, 0, 0, 0), 1.0f, 0); if (m_theme && m_d3dDevice && SUCCEEDED(m_d3dDevice->BeginScene())) { m_theme->Refresh(timestamp); m_theme->Draw(timestamp, this, 0.0, 0.0); m_d3dDevice->EndScene(); m_d3dDevice->Present(NULL, NULL, NULL, NULL); SetThreadExecutionState(ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED); } } else { switch (result) { case D3DERR_DEVICELOST: if (D3DERR_DEVICELOST != m_deviceState) LOG(VB_GENERAL, LOG_ERR, "Device lost"); m_deviceState = D3DERR_DEVICELOST; break; case D3DERR_DRIVERINTERNALERROR: LOG(VB_GENERAL, LOG_ERR, "Driver error - quiting"); m_deviceState = D3DERR_DRIVERINTERNALERROR; qApp->exit(); break; case D3DERR_DEVICENOTRESET: if (D3DERR_DEVICENOTRESET != m_deviceState) LOG(VB_GENERAL, LOG_ERR, "Device needs reset"); m_deviceState = D3DERR_DEVICENOTRESET; HandleDeviceReset(); default: break; } } } FinishDrawing(); if (m_timer) { m_timer->Wait(); m_timer->Start(); } }
void CGLRenderer::DrawScene(CDC *pDC) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glDrawArrays(GL_TRIANGLES, m_dataOffset * 6, 6); ++m_dataOffset; FinishDrawing(); SwapBuffers(pDC->m_hDC); }
void C4GraphicsSystem::Execute() { // activity check if (!StartDrawing()) return; bool fBGDrawn = false; // If lobby running, message board only (page flip done by startup message board) if (!Game.pGUI || !Game.pGUI->HasFullscreenDialog(true)) // allow for message board behind GUI if(Game.Network.isLobbyActive() || !Game.IsRunning) if (Application.isFullScreen) { // Message board if (iRedrawBackground) ClearFullscreenBackground(); MessageBoard.Execute(); if (!Game.pGUI || !C4GUI::IsActive()) { FinishDrawing(); return; } fBGDrawn = true; } // fullscreen GUI? if (Application.isFullScreen && Game.pGUI && C4GUI::IsActive() && (Game.pGUI->HasFullscreenDialog(false) || !Game.IsRunning)) { if (!fBGDrawn && iRedrawBackground) ClearFullscreenBackground(); Game.pGUI->Render(!fBGDrawn); FinishDrawing(); return; } // Fixed screen rate in old network ScreenRate = 1; // Background redraw if (Application.isFullScreen) if (iRedrawBackground) DrawFullscreenBackground(); // Screen rate skip frame draw ScreenTick++; if (ScreenTick>=ScreenRate) ScreenTick=0; // Reset object audibility Game.Objects.ResetAudibility(); // some hack to ensure the mouse is drawn after a dialog close and before any // movement messages if (Game.pGUI && !C4GUI::IsActive()) SetMouseInGUI(false, false); // Viewports for (C4Viewport *cvp=FirstViewport; cvp; cvp=cvp->Next) cvp->Execute(); if (Application.isFullScreen) { // Upper board UpperBoard.Execute(); // Message board MessageBoard.Execute(); // Help & Messages DrawHelp(); DrawHoldMessages(); DrawFlashMessage(); } // InGame-GUI if (Game.pGUI && C4GUI::IsActive()) { Game.pGUI->Render(false); } // Palette update if (fSetPalette) { SetPalette(); /*SetDarkColorTable();*/ fSetPalette=FALSE; } // gamma update if (fSetGamma) { ApplyGamma(); fSetGamma=FALSE; } // Video record & status (fullsrceen) if (Application.isFullScreen) Video.Execute(); // done FinishDrawing(); }
void DrawTree::Draw(string target) { string texfile = target + ".tex"; ofstream os(texfile.c_str()); if (header) { os << "\\documentclass{"; if (beamer) { os << "beamer"; } else { os << "amsart"; } os << "}\n"; os << "\\usepackage{times}\n"; os << "\\usepackage{pgf}\n"; os << "\\usepackage[english]{babel}\n"; os << "\\usepackage{tikz}\n"; os << "\\usepackage{nopageno}\n"; os << '\n'; os << "\\begin{document}\n"; if (beamer) { os << "\\begin{frame}[plain]\n"; } os << "\\begin{center}\n"; } else { os << "\\begin{center}\n"; } PrepareDrawing(); double scaleX = sizeX / GetDepth(); double startX = (GetDepth() - GetDepth(GetRoot())) * scaleX; double scaleY = sizeY / (GetSize(GetRoot()) - 1); // os << "\\setlength{\\unitlength}{0.6cm}\n"; os << "\\begin{tikzpicture}\n"; os << "[anchor=west,font=\\fontsize{" << fontsize << "}{" << fontsize << "}\\selectfont,scale=" << texscale<< "]\n"; // os << "\\begin{tikzpicture}(" << sizeX << ',' << sizeY << ")\n"; os << '\n'; RecursiveDraw(GetRoot(),os,startX,sizeY/2,scaleX,scaleY); RecursiveAfterDraw(GetRoot(),os,startX,sizeY/2,scaleX,scaleY); if (Z) { cerr << "write group names\n"; WriteGroupNames(os); } FinishDrawing(os,scaleX,scaleY); // texscalecale os << '\n'; os << "\\end{tikzpicture}\n"; if (header) { os << "\\end{center}\n"; if (beamer) { os << "\\end{frame}\n"; } os << "\\end{document}\n"; } else { os << "\\end{center}\n"; } os.close(); }
void C4GraphicsSystem::Execute() { // activity check if (!StartDrawing()) return; bool fBGDrawn = false; // If lobby running, message board only (page flip done by startup message board) if (!::pGUI->HasFullscreenDialog(true)) // allow for message board behind GUI if (::Network.isLobbyActive() || !Game.IsRunning) if (!Application.isEditor) { // Message board if (iRedrawBackground) ClearFullscreenBackground(); MessageBoard->Execute(); if (!C4GUI::IsActive()) { FinishDrawing(); return; } fBGDrawn = true; } // fullscreen GUI? if (!Application.isEditor && C4GUI::IsActive() && (::pGUI->HasFullscreenDialog(false) || !Game.IsRunning)) { if (!fBGDrawn && iRedrawBackground) ClearFullscreenBackground(); ::pGUI->Render(!fBGDrawn); FinishDrawing(); return; } // Reset object audibility ::Objects.ResetAudibility(); // some hack to ensure the mouse is drawn after a dialog close and before any // movement messages if (!C4GUI::IsActive()) ::pGUI->SetMouseInGUI(false, false); // Viewports ::Viewports.Execute(!Application.isEditor && iRedrawBackground); if (iRedrawBackground) --iRedrawBackground; if (!Application.isEditor) { // Upper board UpperBoard.Execute(); // Message board MessageBoard->Execute(); // Help & Messages DrawHelp(); DrawHoldMessages(); DrawFlashMessage(); } // InGame-GUI if (C4GUI::IsActive()) { ::pGUI->Render(false); } // done FinishDrawing(); }