public void InitRenderer() { if (active) { gpuRenderer = Renderer.GPURenderer.Create(this, Configuration.Renderer); renderThread.Start(); renderThread2.Start(); recreateBufferFull(); } }
public InkControl() { pm = new PointerManager(this); timer = new System.Windows.Forms.Timer(); timer.Interval = 10; timer.Start(); timer.Tick += timer_tick; this.Paint += this_paint; this.SizeChanged += InkControl_SizeChanged; this.VisibleChanged += InkControl_VisibleChanged; //SizeMode = PictureBoxSizeMode.StretchImage; renderer = new Renderer.GdiRenderer(CreateGraphics()); gpuRenderer = Renderer.GPURenderer.Create(this, RenderMode.Software); this.MouseWheel += InkControl_MouseWheel; this.MouseMove += InkControl_MouseMove; this.MouseDown += InkControl_MouseDown; this.MouseUp += InkControl_MouseUp; recreateBufferFull(); renderThread = new Thread(renderLoop); renderThread2 = new Thread(renderLoop2); /*MenuItem[] contextMenu = new MenuItem[] * { * new MenuItem("Copy"), * new MenuItem("Paste") * }; * this.ContextMenu = new ContextMenu(contextMenu);*/ if (Process.GetCurrentProcess().ProcessName == "devenv") { active = false; } Stream stream = ResManager.GetStream("img/blank.cur"); if (stream != null) { blankCursor = new Cursor(stream); } else { blankCursor = Cursors.Default; } }
public static GPURenderer Create(System.Windows.Forms.Control cltr, RenderMode renderMode) { if (Process.GetCurrentProcess().ProcessName == "devenv") { return(new GPURenderer2(cltr)); } #if SLIMDX GPURenderer r = null; try { if (!tryHardware) { r = new GPURenderer2(cltr); } else { r = new GPURenderer1(cltr); } } catch (Exception e) { Console.WriteLine("Cant create Renderer\n" + e.Message); r?.Dispose(); r = new GPURenderer2(cltr); } return(r); #else switch (renderMode) { case RenderMode.OpenGL: return(new GPURenderer3(cltr)); case RenderMode.Direct2D: return(new GPURenderer1(cltr)); case RenderMode.Software: return(new GPURenderer2(cltr)); default: throw new Exception("Unknown RenderMode " + renderMode.ToString()); } #endif }