/// <summary> /// /// </summary> /// <param name="handle"></param> /// <param name="fullScreen"></param> /// <param name="doubleBuffer"></param> /// <returns></returns> public IGraphicsSurface CreatePrimarySurface(IntPtr handle, Boolean fullScreen, Boolean doubleBuffer) { DDSURFACEDESC2 tempDescr = new DDSURFACEDESC2(); tempDescr.lFlags = CONST_DDSURFACEDESCFLAGS.DDSD_CAPS; tempDescr.ddsCaps.lCaps = CONST_DDSURFACECAPSFLAGS.DDSCAPS_PRIMARYSURFACE; if (doubleBuffer) { tempDescr.lFlags |= CONST_DDSURFACEDESCFLAGS.DDSD_BACKBUFFERCOUNT; tempDescr.lBackBufferCount = 1; tempDescr.ddsCaps.lCaps |= CONST_DDSURFACECAPSFLAGS.DDSCAPS_COMPLEX | CONST_DDSURFACECAPSFLAGS.DDSCAPS_FLIP; } DirectDrawSurface surface = new DirectDrawSurface(tempDescr); if (fullScreen) { return(surface); } DirectDrawClipper clipper = DirectDraw.CreateClipper(0); clipper.SetHWnd(handle.ToInt32()); surface.Surface.SetClipper(clipper); return(surface); }
/// <summary> /// Draw the view to the specified point of the given surface. /// </summary> public void draw(Surface target, Point pt) { try { updateScreen(); } catch (COMException e) { if (DirectDraw.isSurfaceLostException(e)) { PictureManager.onSurfaceLost(this, null); updateScreen(); // and retry } else { throw e; // unable to handle this exception } } // just send the offscreen buffer to the primary surface // drawContext will be null if the client size is empty or the window is minimized. // no blitting necessary in that case. if (drawContext != null) { target.blt(pt, drawContext.surface); } }
/// <summary> /// /// </summary> /// <param name="handle"></param> public void SetFullScreenMode(IntPtr handle) { DirectDraw.SetCooperativeLevel( handle.ToInt32(), CONST_DDSCLFLAGS.DDSCL_FULLSCREEN | CONST_DDSCLFLAGS.DDSCL_EXCLUSIVE | CONST_DDSCLFLAGS.DDSCL_ALLOWREBOOT); DirectDraw.SetDisplayMode(640, 480, 16, 0, 0); }
/// <summary> /// /// </summary> /// <param name="handle"></param> public void SetFullScreenMode(IntPtr handle) { try { DirectDraw.SetCooperativeLevel(handle.ToInt32(), DxVBLib.CONST_DDSCLFLAGS.DDSCL_FULLSCREEN | DxVBLib.CONST_DDSCLFLAGS.DDSCL_EXCLUSIVE | DxVBLib.CONST_DDSCLFLAGS.DDSCL_ALLOWREBOOT); DirectDraw.SetDisplayMode(640, 480, 16, 0, 0); } catch (GraphicsException e) { throw new GraphicsException("setting up Full screen", e); } }
/// <param name="initialView"> /// the region that this object draws in the A,B axis. /// </param> public QuarterViewDrawer(World _world, DirectDraw directDraw, Rectangle initialView) { this.world = _world; _heightCutHeight = world.size.z - 1; this.directDraw = directDraw; recreateDrawBuffer(initialView.Size, true); topLeft = new Point(initialView.X, initialView.Y); world.voxelOutlookListeners.Add(this); onUpdateAllVoxels(); // initially all the rects are dirty PictureManager.onSurfaceLost += new EventHandler(onSurfaceLost); }
/// <summary> /// /// </summary> /// <param name="handle"></param> public void SetWindow(IntPtr handle) { DirectDraw.SetCooperativeLevel( handle.ToInt32(), CONST_DDSCLFLAGS.DDSCL_NORMAL); }