/// <summary> /// Full screen mode or un-do full screen mode. /// </summary> public void FullScreenMode() { int hr = 0; // Stop and reset postion to beginning if ((_currentState == PlayState.Paused) || (_currentState == PlayState.Running) || (_currentState == PlayState.Stopped)) { OABool mode; // Don't bother with full-screen for audio-only files if ((_isAudioOnly) || (_videoWindow == null)) { return; } // Read current state hr = _videoWindow.get_FullScreenMode(out mode); DsError.ThrowExceptionForHR(hr); if (mode == OABool.False) { // Save current message drain hr = _videoWindow.get_MessageDrain(out _pDrain); DsError.ThrowExceptionForHR(hr); // Set message drain to application main window hr = _videoWindow.put_MessageDrain(_playWindow.Handle); DsError.ThrowExceptionForHR(hr); // Switch to full-screen mode mode = OABool.True; hr = _videoWindow.put_FullScreenMode(mode); DsError.ThrowExceptionForHR(hr); _isFullScreen = true; } else { // Switch back to windowed mode mode = OABool.False; hr = _videoWindow.put_FullScreenMode(mode); DsError.ThrowExceptionForHR(hr); // Undo change of message drain hr = _videoWindow.put_MessageDrain(_pDrain); DsError.ThrowExceptionForHR(hr); // Reset video window hr = _videoWindow.SetWindowForeground(OABool.True); DsError.ThrowExceptionForHR(hr); // Reclaim keyboard focus for player application //this.Focus(); _isFullScreen = false; } } }
public void fullScreenMode(bool pFullScreenOption) { IVideoWindow videoWindow = m_FilterGraph as IVideoWindow; if (pFullScreenOption) { videoWindow.put_FullScreenMode(OABool.True); } else { videoWindow.put_FullScreenMode(OABool.False); } }
// Starts playing a new cinematic public void PlayCinematic(string file, int x, int y, int w, int h) { // Lame bugfix: DirectShow and Fullscreen doesnt like eachother if (CVars.Instance.Get("r_fs", "0", CVarFlags.ARCHIVE).Integer == 1) { if (AlterGameState) { playing = true; StopCinematic(); } return; } // Check if file exists if (FileCache.Instance.Contains(file)) file = FileCache.Instance.GetFile(file).FullName; else { if (AlterGameState) { playing = true; StopCinematic(); } Common.Instance.WriteLine("PlayCinematic: Could not find video: {0}", file); return; } // Have the graph builder construct its the appropriate graph automatically this.graphBuilder = (IGraphBuilder)new FilterGraph(); int hr = graphBuilder.RenderFile(file, null); DsError.ThrowExceptionForHR(hr); mediaControl = (IMediaControl)this.graphBuilder; mediaEventEx = (IMediaEventEx)this.graphBuilder; videoWindow = this.graphBuilder as IVideoWindow; basicVideo = this.graphBuilder as IBasicVideo; // Setup the video window hr = this.videoWindow.put_Owner(Renderer.Instance.form.Handle); DsError.ThrowExceptionForHR(hr); hr = this.videoWindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipSiblings | WindowStyle.ClipChildren); DsError.ThrowExceptionForHR(hr); // Set the video size //int lWidth, lHeight; //hr = this.basicVideo.GetVideoSize(out lWidth, out lHeight); hr = this.videoWindow.SetWindowPosition(x, y, w, h); videoWindow.put_FullScreenMode((CVars.Instance.Get("r_fs", "0", CVarFlags.ARCHIVE).Integer == 1) ? OABool.True : OABool.False); DsError.ThrowExceptionForHR(hr); // Run the graph to play the media file hr = this.mediaControl.Run(); DsError.ThrowExceptionForHR(hr); playing = true; if (AlterGameState) Client.Instance.state = CubeHags.common.ConnectState.CINEMATIC; Common.Instance.WriteLine("Playing cinematic: {0}", file); EventCode code; }
//////////////// /// Get/Put FullScreenMode private void TestFullScreenMode() { int hr; OABool FullScreenMode1, FullScreenMode2; // Read the current value hr = m_ivw.get_FullScreenMode(out FullScreenMode1); Marshal.ThrowExceptionForHR(hr); // Change it hr = m_ivw.put_FullScreenMode(~FullScreenMode1); Marshal.ThrowExceptionForHR(hr); // Re-read hr = m_ivw.get_FullScreenMode(out FullScreenMode2); Marshal.ThrowExceptionForHR(hr); // Make sure the value we set is what we just read Debug.Assert(FullScreenMode1 != FullScreenMode2, "Put/Get FullScreenMode"); // Try it the other way // Read the current value hr = m_ivw.get_FullScreenMode(out FullScreenMode1); Marshal.ThrowExceptionForHR(hr); // Change it hr = m_ivw.put_FullScreenMode(~FullScreenMode1); Marshal.ThrowExceptionForHR(hr); // Re-read hr = m_ivw.get_FullScreenMode(out FullScreenMode2); Marshal.ThrowExceptionForHR(hr); // Make sure the value we set is what we just read Debug.Assert(FullScreenMode1 != FullScreenMode2, "Put/Get FullScreenMode"); }