Example #1
0
        public void LoadDemo(Mini.DemoBase demo)
        {
            _demo = demo;
            demo.Init();



            int max = Math.Max(_w, _h);

            demo.Width  = _w;
            demo.Height = _h;
            GLPainterCore pcx           = null;
            GLPainter     canvasPainter = null;

            //if demo not create canvas and painter
            //the we create for it
            //int max = Math.Max(w, h);
            //canvas2d = PixelFarm.Drawing.GLES2.GLES2Platform.CreateCanvasGL2d(max, max);
            //canvasPainter = new GLCanvasPainter(canvas2d, max, max);

            //canvas2d = PixelFarm.Drawing.GLES2.GLES2Platform.CreateCanvasGL2d(w, h);
            pcx            = GLPainterCore.Create(max, max, _w, _h, true);
            pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOriginKind.LeftTop;
            canvasPainter  = new GLPainter();
            canvasPainter.BindToPainterCore(pcx);

            //create text printer for opengl
            //----------------------
            //1. win gdi based
            //var printer = new WinGdiFontPrinter(canvas2d, w, h);
            //canvasPainter.TextPrinter = printer;
            //----------------------
            //2. raw vxs
            //var printer = new PixelFarm.Drawing.Fonts.VxsTextPrinter(canvasPainter);
            //canvasPainter.TextPrinter = printer;
            //----------------------
            //3. agg texture based font texture
            //var printer = new AggFontPrinter(canvasPainter, w, h);
            //canvasPainter.TextPrinter = printer;
            //----------------------
            //4. texture atlas based font texture
            //------------
            //resolve request font
            //var printer = new GLBmpGlyphTextPrinter(canvasPainter, YourImplementation.BootStrapWinGdi.myFontLoader);
            //canvasPainter.TextPrinter = printer;

            _getTextPrinterDel?.Invoke(canvasPainter);



            demo.SetEssentialGLHandlers(
                null,
                () => IntPtr.Zero,
                () => IntPtr.Zero);

            DemoBase.InvokeGLPainterReady(demo, pcx, canvasPainter);
            DemoBase.InvokePainterReady(demo, canvasPainter);
        }