public static void RunSpecificDemo(LayoutFarm.DemoBase demo) { //------------------------------- Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ////------------------------------- //1. select view port kind InnerViewportKind innerViewportKind = InnerViewportKind.GdiPlus; var workingArea = Screen.PrimaryScreen.WorkingArea; var formCanvas = FormCanvasHelper.CreateNewFormCanvas( workingArea.Width, workingArea.Height, innerViewportKind, out _latestviewport); formCanvas.Text = "PixelFarm" + innerViewportKind; demo.StartDemo(new LayoutFarm.SampleViewport(_latestviewport)); _latestviewport.TopDownRecalculateContent(); //================================================== _latestviewport.PaintMe(); //_latestviewport.PaintMe(); //formCanvas.WindowState = FormWindowState.Maximized; formCanvas.Show(); //got specfic example Application.Run(formCanvas); }
public void CreateMainForm(int w, int h) { GlFwForm form1 = new GlFwForm(w, h, "PixelFarm on GLfw and GLES2"); MyRootGraphic myRootGfx = new MyRootGraphic(w, h, s_textServices); var canvasViewport = new UISurfaceViewportControl(); canvasViewport.InitRootGraphics(myRootGfx, myRootGfx.TopWinEventPortal, InnerViewportKind.GLES); canvasViewport.SetBounds(0, 0, w, h); form1.Controls.Add(canvasViewport); _surfaceViewport = canvasViewport; LayoutFarm.AppHostNeutral appHost = new LayoutFarm.AppHostNeutral(canvasViewport); form1.SetDrawFrameDelegate(e => { _surfaceViewport.PaintMeFullMode(); }); if (_app != null) { appHost.StartApp(_app);//start app canvasViewport.TopDownRecalculateContent(); canvasViewport.PaintMe(); } }