ibool Main::OnSysCommand(Param& param) { switch (param.wParam & 0xFFF0) { case SC_MOVE: case SC_SIZE: return Fullscreen(); case SC_MONITORPOWER: case SC_SCREENSAVE: return Fullscreen() || emulator.IsOn(); case SC_MAXIMIZE: if (Fullscreen()) return true; case SC_MINIMIZE: case SC_RESTORE: if (Windowed()) emulator.Stop(); break; } return false; }
bool Main::ToggleMenu() const { bool visible = menu.Visible(); if (Fullscreen() || !window.Restored()) { if (Fullscreen() && !visible && !CanRunInBackground()) emulator.Stop(); visible = menu.Toggle(); } else { Point size; if (visible) { size.y = menu.Height(); menu.Hide(); window.Size() -= size; visible = false; } else { menu.Show(); size.y = menu.Height(); window.Size() += size; visible = true; } } return visible; }
ibool Main::OnActivate(Param& param) { if (param.Activator().Entering()) { if (Fullscreen() && param.Activator().Minimized()) emulator.Stop(); } else { if (!CanRunInBackground() || (Fullscreen() && param.Activator().OutsideApplication())) emulator.Stop(); } return false; }
void FForwardPlusRenderer::DoDepthNormalPrePass(const FCamera& Camera, class IScene* Scene) { // Clear depth buffer ID3D11DeviceContext* DeviceContext = GraphicsContext->GetImmediateContext(); const FLOAT NormalsClearColour[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; const FLOAT DepthClearColour[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; ID3D11RenderTargetView* Targets[2] = { NormalTarget->GetRenderTarget(), DepthTarget->GetRenderTarget() }; DeviceContext->ClearDepthStencilView(GraphicsContext->GetDepthStencil(), D3D11_CLEAR_STENCIL | D3D11_CLEAR_DEPTH, 1.0f, 0); DeviceContext->ClearRenderTargetView(NormalTarget->GetRenderTarget(), NormalsClearColour); DeviceContext->ClearRenderTargetView(DepthTarget->GetRenderTarget(), DepthClearColour); DeviceContext->OMSetRenderTargets(2, Targets, GraphicsContext->GetDepthStencil()); FViewport Fullscreen(0, 0, GraphicsContext->GetWidth(), GraphicsContext->GetHeight()); D3D11_VIEWPORT Viewport = Fullscreen.CreateRenderViewport(); DeviceContext->RSSetViewports(1, &Viewport); InstanceBuffer->SetWorld(glm::mat4(1.0)); FDrawCall Params(DeviceContext, InstanceBuffer.Get()); Params.OverrideMaterial = std::bind(&FForwardPlusRenderer::OverrideMaterialDepthNormalPass, this, std::placeholders::_1); Scene->Draw(Params); }
void FForwardPlusRenderer::DoScenePass(const FCamera& Camera, class IScene* Scene) { // Clear depth buffer ID3D11DeviceContext* DeviceContext = GraphicsContext->GetImmediateContext(); const FLOAT ClearColour[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; ID3D11RenderTargetView* BackBuffer = HighDynamicRangeMSAATarget->GetRenderTarget(); DeviceContext->ClearDepthStencilView(HighDynamicRangeMSAATarget->GetDepthStencil(), D3D11_CLEAR_STENCIL | D3D11_CLEAR_DEPTH, 1.0f, 0); DeviceContext->ClearRenderTargetView(BackBuffer, ClearColour); DeviceContext->OMSetRenderTargets(1, &BackBuffer, HighDynamicRangeMSAATarget->GetDepthStencil()); FViewport Fullscreen(0, 0, GraphicsContext->GetWidth(), GraphicsContext->GetHeight()); D3D11_VIEWPORT Viewport = Fullscreen.CreateRenderViewport(); DeviceContext->RSSetViewports(1, &Viewport); InstanceBuffer->SetWorld(glm::mat4(1.0)); ID3D11RasterizerState* PreviousState = nullptr; if (ForceWireframe.AsBoolean()) { DeviceContext->RSGetState(&PreviousState); DeviceContext->RSSetState(GraphicsContext->GetRenderStates()->WireframeRasterizer); } FDrawCall Params(DeviceContext, InstanceBuffer.Get()); Scene->Draw(Params); if (PreviousState != nullptr) { DeviceContext->RSSetState(PreviousState); } }
void DBusRootAdaptor::emitFullscreenChanged() { QVariantMap properties; properties["Fullscreen"] = Fullscreen(); DBusInterface::updateProperties("org.mpris.MediaPlayer2", properties); }
void Main::OnCmdViewShowMenu(uint) { const bool visible = ToggleMenu(); if (Fullscreen()) Application::Instance::ShowChildWindows( visible ); }
ibool Main::OnCommandResume(Param& param) { if (HIWORD(param.wParam) == 0 && Fullscreen() && emulator.IsOn() && menu.Visible()) window.PostCommand( IDM_VIEW_MENU ); // Hide menu and resume emulation return true; }
// Input // - handle user input bool CGame::Input( void ) { // Read the devices m_pDI->ReadDevices(); //toggle full screen with Alt + Enter if( (m_pDI->KeyDown( DIK_LALT) == true) && m_pDI->KeyPressed( DIK_RETURN ) == true ) { m_pProfile->Fullscreen(!m_pProfile->Fullscreen()); Fullscreen( m_pProfile->Fullscreen() != 0 ); return true; } //toggle language if( (m_pDI->KeyDown( DIK_LALT) == true) && m_pDI->KeyPressed( DIK_L ) == true ) { if(m_pProfile->Language()) m_pProfile->Language(LANG_NEUTRAL); else m_pProfile->Language(LANG_SPANISH); } // toggle fps with f1 if (m_pDI->KeyPressed(DIK_F1) == true) m_bShowFPS = !m_bShowFPS; return m_pGameState->Input(); }
void HumanClientApp::Reinitialize() { bool fullscreen = GetOptionsDB().Get<bool>("fullscreen"); bool fake_mode_change = GetOptionsDB().Get<bool>("fake-mode-change"); std::pair<int, int> size = GetWindowWidthHeight(); bool fullscreen_transition = Fullscreen() != fullscreen; GG::X old_width = AppWidth(); GG::Y old_height = AppHeight(); SetVideoMode(GG::X(size.first), GG::Y(size.second), fullscreen, fake_mode_change); if (fullscreen_transition) { FullscreenSwitchSignal(fullscreen); // after video mode is changed but before DoLayout() calls } else if (fullscreen && (old_width != size.first || old_height != size.second) && GetOptionsDB().Get<bool>("UI.auto-reposition-windows")) { // Reposition windows if in fullscreen mode... handled here instead of // HandleWindowResize() because the prev. fullscreen resolution is only // available here. RepositionWindowsSignal(); } // HandleWindowResize is already called via this signal sent from // SDLGUI::HandleSystemEvents() when in windowed mode. This sends the // signal (and hence calls HandleWindowResize()) when in fullscreen mode, // making the signal more consistent... if (fullscreen) { WindowResizedSignal(GG::X(size.first), GG::Y(size.second)); } }
bool MainWindow::OnActivate() { SingleWindow::OnActivate(); Fullscreen(); return true; }
void HumanClientApp::HandleWindowMove(GG::X w, GG::Y h) { //DebugLogger() << "HumanClientApp::HandleWindowMove(" << Value(w) << ", " << Value(h) << ")"; if (!Fullscreen()) { GetOptionsDB().Set<int>("app-left-windowed", Value(w)); GetOptionsDB().Set<int>("app-top-windowed", Value(h)); GetOptionsDB().Commit(); } }
void Main::OnEmuEvent(const Managers::Emulator::Event event,const Managers::Emulator::Data data) { switch (event) { case Managers::Emulator::EVENT_POWER_ON: case Managers::Emulator::EVENT_POWER_OFF: if (emulator.NetPlayers()) { menu.ToggleModeless( event == Managers::Emulator::EVENT_POWER_ON ); } else if (Fullscreen()) { const bool show = (event == Managers::Emulator::EVENT_POWER_OFF); menu.Show( show ); Application::Instance::ShowChildWindows( show ); } break; case Managers::Emulator::EVENT_LOAD: { Path name; if (emulator.IsCart()) { name = Nes::Cartridge(emulator).GetProfile()->game.title.c_str(); } else if (emulator.IsNsf()) { name.Import( Nes::Nsf(emulator).GetName() ); } if (name.Empty()) { name = emulator.GetImagePath().Target().File(); name.Extension().Clear(); } if (name.Length()) window.Text() << (name << " - " << MainWindow::name).Ptr(); break; } case Managers::Emulator::EVENT_UNLOAD: window.Text() << MainWindow::name; break; case Managers::Emulator::EVENT_NETPLAY_MODE: menu[IDM_VIEW_SWITCH_SCREEN].Enable( !data ); break; } }
void MenuBar::AddEmulationMenu() { QMenu* emu_menu = addMenu(tr("Emulation")); m_play_action = emu_menu->addAction(tr("Play"), this, SIGNAL(Play())); m_pause_action = emu_menu->addAction(tr("Pause"), this, SIGNAL(Pause())); m_stop_action = emu_menu->addAction(tr("Stop"), this, SIGNAL(Stop())); m_reset_action = emu_menu->addAction(tr("Reset"), this, SIGNAL(Reset())); m_fullscreen_action = emu_menu->addAction(tr("Fullscreen"), this, SIGNAL(Fullscreen())); m_frame_advance_action = emu_menu->addAction(tr("Frame Advance"), this, SIGNAL(FrameAdvance())); m_screenshot_action = emu_menu->addAction(tr("Take Screenshot"), this, SIGNAL(Screenshot())); AddStateLoadMenu(emu_menu); AddStateSaveMenu(emu_menu); AddStateSlotMenu(emu_menu); UpdateStateSlotMenu(); }
void SCSapplication::Start () { m_iRunning = SCS_TRUE; Init(); Load(); while (m_iRunning) { BeginFrame(); if (m_iUseTargetFPS) { if (m_kFrameTimer.TimeExpired()) { m_kFrameTimer.Restart(); Frame(); EndFrame(); } continue; } Frame(); EndFrame(); } Unload(); Fullscreen(SCS_FALSE); SDL_Quit(); }
int OSXWindowCapture::Height() { int height = CGRectGetHeight( mRect ); return Fullscreen() ? height : std::max< int >( height - OSX_WINDOW_TITLE_BAR_HEIGHT, 0 ); }
int OSXWindowCapture::Top() { return CGRectGetMinY( mRect ) + ( Fullscreen() ? 0 : OSX_WINDOW_TITLE_BAR_HEIGHT ); }
void FForwardPlusRenderer::DrawScene(const FCamera& Camera, class IScene* Scene) { FProfiler::Get().PushSection("Rendering", "Forward+"); FMaterialParameters::FlushShaderResources(GraphicsContext->GetImmediateContext()); CurrentViewport = Camera.GetViewport(); // Setup buffers UpdateFrameData(Camera, Scene); { FProfiler::Get().PushSection("Rendering", "Depth-Normal PrePass"); // We use the result of this pass for both SSAO and Light Culling (we need depth information for that). DoDepthNormalPrePass(Camera, Scene); if (SSAOEnabled.AsBoolean()) { AmbientOcclusion->Apply(CurrentViewport, DepthTarget.Get(), NormalTarget.Get(), OcclusionTarget.Get()); MaterialManager->SetGlobalResourceView(FScreenSpaceAmbientOcclusion::kAmbientOcclusionMap, OcclusionTarget->GetRenderResource()); } FProfiler::Get().PopSection(); } { FProfiler::Get().PushSection("Rendering", "Shadow Maps Pass"); // Render shadow maps if (ShadowMappingEnabled.AsBoolean()) ShadowMapping->GatherShadowMaps(Scene); FProfiler::Get().PopSection(); } { FProfiler::Get().PushSection("Rendering", "Light Culling Pass"); // Perform light culling and upload light buffers LightPass->Apply(this, ShadowMapping.Get(), DepthTarget.Get(), Scene, Camera); FProfiler::Get().PopSection(); } { FProfiler::Get().PushSection("Rendering", "Scene Pass"); // Render the scene in forward fashion DoScenePass(Camera, Scene); FProfiler::Get().PopSection(); } { FProfiler::Get().PushSection("Rendering", "HDR Post Process Pass"); HighDynamicRangeTarget->ResolveFrom(GraphicsContext->GetImmediateContext(), HighDynamicRangeMSAATarget.Get()); HighDynamicRange->Apply(CurrentViewport, HighDynamicRangeTarget.Get(), GraphicsContext->GetBackBuffer()); FProfiler::Get().PopSection(); } FProfiler::Get().PopSection(); #if DEBUG FViewport Fullscreen(0, 0, GraphicsContext->GetWidth(), GraphicsContext->GetHeight()); D3D11_VIEWPORT Viewport = Fullscreen.CreateRenderViewport(); ID3D11RenderTargetView* RenderTarget = GraphicsContext->GetBackBuffer(); GraphicsContext->GetImmediateContext()->RSSetViewports(1, &Viewport); GraphicsContext->GetImmediateContext()->ClearDepthStencilView(GraphicsContext->GetDepthStencil(), D3D11_CLEAR_STENCIL | D3D11_CLEAR_DEPTH, 1.0f, 0); GraphicsContext->GetImmediateContext()->OMSetRenderTargets(1, &RenderTarget, GraphicsContext->GetDepthStencil()); if (ShowHdrDebug.AsBoolean()) { HighDynamicRange->DebugHdr(SpriteBatch.Get()); FInstanceBuffer InstanceBuffer = FInstanceBuffer::Identity; FDrawCall DrawCall(GraphicsContext->GetImmediateContext(), &InstanceBuffer, nullptr); SpriteBatch->Render(DrawCall); } #endif }