public MDX1_Surface() { mDisplay = Display.Impl as MDX1_Display; mDevice = mDisplay.D3D_Device; InitVerts(); }
public MDX1_Surface(Size size) { mSrcRect = new Rectangle(new Point(0, 0), size); mDisplay = Display.Impl as MDX1_Display; mDevice = mDisplay.D3D_Device; /* * Bitmap bitmap = new Bitmap(size.Width, size.Height); * Graphics g = Graphics.FromImage(bitmap); * g.Clear(Color.FromArgb(0, 0, 0, 0)); * g.Dispose(); */ //mTexture = Texture.FromBitmap(mDevice, bitmap, Usage.None, Pool.Managed); mTexture = new Ref <Texture>(new Texture(mDevice.Device, size.Width, size.Height, 1, Usage.None, Format.A8R8G8B8, Pool.Managed)); mRenderToSurface = new RenderToSurface(mDevice.Device, size.Width, size.Height, Format.A8R8G8B8, true, DepthFormat.D16); mRenderToSurface.BeginScene(mTexture.Value.GetSurfaceLevel(0)); mDevice.Clear(ClearFlags.Target, Color.FromArgb(0, 0, 0, 0).ToArgb(), 1.0f, 0); mRenderToSurface.EndScene(Filter.None); mRenderToSurface.Dispose(); mRenderToSurface = null; mTextureSize = mSrcRect.Size; InitVerts(); }
public MDX1_FontSurface(string fontFamily, float sizeInPoints) { mDisplay = Display.Impl as MDX1_Display; mWinFont = new System.Drawing.Font(fontFamily, sizeInPoints); CreateD3DFont(); //Color = Color.FromArgb(255, Color.Black); mDisplay.DeviceLost += new EventHandler(D3D_Device_DeviceLost); mDisplay.DeviceReset += new EventHandler(D3D_Device_DeviceReset); mDisplay.DeviceAboutToReset += new EventHandler(D3D_Device_DeviceLost); }
public MDX1_Surface(Ref <Texture> texture, Rectangle sourceRect) { mSrcRect = sourceRect; mDisplay = Display.Impl as MDX1_Display; mDevice = mDisplay.D3D_Device; mTexture = new Ref <Texture>(texture); mTextureSize = new Size(mTexture.Value.GetSurfaceLevel(0).Description.Width, mTexture.Value.GetSurfaceLevel(0).Description.Height); InitVerts(); }
public MDX1_Surface(Stream stream) { mDisplay = Display.Impl as MDX1_Display; mDevice = mDisplay.D3D_Device; if (mDevice == null) { throw new Exception("Error: It appears that AgateLib has not been initialized yet. Have you created a DisplayWindow?"); } LoadFromStream(stream); InitVerts(); }
public MDX1_DisplayWindow(CreateWindowParams windowParams) { mChoosePosition = windowParams.WindowPosition; if (windowParams.RenderToControl) { if (typeof(Control).IsAssignableFrom(windowParams.RenderTarget.GetType()) == false) { throw new ArgumentException("The specified render target does not derive from System.Windows.Forms.Control"); } mRenderTarget = (Control)windowParams.RenderTarget; mChooseFullscreen = false; mChooseWidth = mRenderTarget.ClientSize.Width; mChooseHeight = mRenderTarget.ClientSize.Height; mDisplay = Display.Impl as MDX1_Display; mDisplay.Initialize(this); mDisplay.VSyncChanged += new EventHandler(mDisplay_VSyncChanged); AttachEvents(); CreateBackBuffer(); } else { if (string.IsNullOrEmpty(windowParams.IconFile) == false) { mIcon = new Drawing.Icon(windowParams.IconFile); } mTitle = windowParams.Title; mChooseFullscreen = windowParams.IsFullScreen; mChooseWidth = windowParams.Width; mChooseHeight = windowParams.Height; mChooseResize = windowParams.IsResizable; mHasFrame = windowParams.HasFrame; CreateWindow(mChooseFullscreen); mDisplay = Display.Impl as MDX1_Display; mDisplay.Initialize(this); mDisplay.VSyncChanged += new EventHandler(mDisplay_VSyncChanged); AttachEvents(); CreateBackBuffer(); } }
public MDX1_Surface(string fileName) { mFileName = fileName; mDisplay = Display.Impl as MDX1_Display; mDevice = mDisplay.D3D_Device; if (mDevice == null) { throw new Exception("Error: It appears that AgateLib has not been initialized yet. Have you created a DisplayWindow?"); } LoadFromFile(); mDevice.Device.DeviceReset += new EventHandler(mDevice_DeviceReset); InitVerts(); }