コード例 #1
0
ファイル: DebugCanvas.cs プロジェクト: Guardian820/OpenMOBA
        public static DebugCanvas CreateAndShowCanvas(Size displaySize = default(Size))
        {
            displaySize = displaySize == default(Size) ? new Size(1000, 1000) : displaySize;
            var drawPadding = new Point(100, 100);

            var canvas = new DebugCanvas(displaySize, drawPadding, OrthographicXYProjector.Instance);

            DebugCanvasHost.CreateShow(canvas);

            return(canvas);
        }
コード例 #2
0
ファイル: DebugCanvas.cs プロジェクト: Guardian820/OpenMOBA
        private static DebugCanvasHost CreateShow(DebugCanvas canvas)
        {
            DebugCanvasHost canvasHost = null;
            var             shownLatch = new ManualResetEvent(false);
            var             thread     = new Thread(() => {
                canvasHost             = new DebugCanvasHost(canvas);
                canvasHost.form.Shown += (s, e) => shownLatch.Set();
                Application.Run(canvasHost.form);
            });

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
            shownLatch.WaitOne();
            return(canvasHost);
        }