Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            RequestWindowFeature(WindowFeatures.NoTitle);
            if (SupportedOpenGLVersion() >= 3)
            {
                // SetContentView(new LibPaintingView(ApplicationContext, null));

                // Inject Fusee.Engine.Base InjectMe dependencies
                IO.IOImp = new IOImp(ApplicationContext);

                var fap = new Fusee.Base.Imp.Android.ApkAssetProvider(ApplicationContext);
                fap.RegisterTypeHandler(
                    new AssetHandler
                {
                    ReturnedType = typeof(Font),
                    Decoder      = delegate(string id, object storage)
                    {
                        if (Path.GetExtension(id).ToLower().Contains("ttf"))
                        {
                            return new Font
                            {
                                _fontImp = new FontImp((Stream)storage)
                            }
                        }
                        ;
                        return(null);
                    },
                    Checker = delegate(string id) {
                        return(Path.GetExtension(id).ToLower().Contains("ttf"));
                    }
                });
Esempio n. 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);
            RequestWindowFeature(WindowFeatures.NoTitle);
            if (SupportedOpenGLVersion() >= 3)
            {
                // SetContentView(new LibPaintingView(ApplicationContext, null));

                // Inject Fusee.Engine.Base InjectMe dependencies
                IO.IOImp = new IOImp(ApplicationContext);

                var fap = new Fusee.Base.Imp.Android.ApkAssetProvider(ApplicationContext);
                fap.RegisterTypeHandler(
                    new AssetHandler
                    {
                        ReturnedType = typeof(Font),
                        Decoder = delegate (string id, object storage)
                        {
                            if (Path.GetExtension(id).ToLower().Contains("ttf"))
                                return new Font
                                {
                                    _fontImp = new FontImp((Stream)storage)
                                };
                            return null;
                        },
                        Checker = delegate (string id) {
                            return Path.GetExtension(id).ToLower().Contains("ttf");
                        }
                    });
                fap.RegisterTypeHandler(
                    new AssetHandler
                    {
                        ReturnedType = typeof(SceneContainer),
                        Decoder = delegate (string id, object storage)
                        {
                            if (Path.GetExtension(id).ToLower().Contains("fus"))
                            {
                                var ser = new Serializer();
                                return ser.Deserialize((Stream)storage, null, typeof(SceneContainer)) as SceneContainer;
                            }
                            return null;
                        },
                        Checker = delegate (string id)
                        {
                            return Path.GetExtension(id).ToLower().Contains("fus");
                        }
                    });
                AssetStorage.RegisterProvider(fap);

                var app = new Core.Main();

                // Inject Fusee.Engine InjectMe dependencies (hard coded)
                RenderCanvasImp rci = new RenderCanvasImp(ApplicationContext, null, delegate { app.Run(); });
                app.CanvasImplementor = rci;
                app.ContextImplementor = new RenderContextImp(rci, ApplicationContext);

                SetContentView(rci.View);

                Engine.Core.Input.AddDriverImp(
                    new Fusee.Engine.Imp.Graphics.Android.RenderCanvasInputDriverImp(app.CanvasImplementor));
                // Engine.Core.Input.AddDriverImp(new Fusee.Engine.Imp.Graphics.Android.WindowsTouchInputDriverImp(app.CanvasImplementor));
                // Deleayed into rendercanvas imp....app.Run() - SEE DELEGATE ABOVE;
            }
            else
            {
                Toast.MakeText(ApplicationContext, "Hardware does not support OpenGL ES 3.0 - Aborting...", ToastLength.Long);
                Log.Info("@string/app_name", "Hardware does not support OpenGL ES 3.0 - Aborting...");
            }
        }
Esempio n. 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            RequestWindowFeature(WindowFeatures.NoTitle);
            if (SupportedOpenGLVersion() >= 3)
            {
                // SetContentView(new LibPaintingView(ApplicationContext, null));

                // Inject Fusee.Engine.Base InjectMe dependencies
                IO.IOImp = new IOImp(ApplicationContext);

                var fap = new Fusee.Base.Imp.Android.ApkAssetProvider(ApplicationContext);
                fap.RegisterTypeHandler(
                    new AssetHandler
                {
                    ReturnedType = typeof(Font),
                    Decoder      = delegate(string id, object storage)
                    {
                        if (Path.GetExtension(id).ToLower().Contains("ttf"))
                        {
                            return(new Font
                            {
                                _fontImp = new FontImp((Stream)storage)
                            });
                        }

                        return(null);
                    },
                    Checker = delegate(string id)
                    {
                        return(Path.GetExtension(id).ToLower().Contains("ttf"));
                    }
                });
                fap.RegisterTypeHandler(
                    new AssetHandler
                {
                    ReturnedType = typeof(SceneContainer),
                    Decoder      = delegate(string id, object storage)
                    {
                        if (Path.GetExtension(id).ToLower().Contains("fus"))
                        {
                            return(FusSceneConverter.ConvertFrom(ProtoBuf.Serializer.Deserialize <FusFile>((Stream)storage), id));
                        }
                        return(null);
                    },
                    Checker = delegate(string id)
                    {
                        return(Path.GetExtension(id).ToLower().Contains("fus"));
                    }
                });
                AssetStorage.RegisterProvider(fap);

                var app = new Core.Deferred();

                // Inject Fusee.Engine InjectMe dependencies (hard coded)
                var rci = new RenderCanvasImp(ApplicationContext, null, delegate
                {
                    app.InitApp();
                    app.Run();
                });
                app.CanvasImplementor  = rci;
                app.ContextImplementor = new RenderContextImp(rci, ApplicationContext);

                SetContentView(rci.View);

                Engine.Core.Input.AddDriverImp(
                    new Fusee.Engine.Imp.Graphics.Android.RenderCanvasInputDriverImp(app.CanvasImplementor));
                // Engine.Core.Input.AddDriverImp(new Fusee.Engine.Imp.Graphics.Android.WindowsTouchInputDriverImp(app.CanvasImplementor));
                // Deleayed into rendercanvas imp....app.Run() - SEE DELEGATE ABOVE;
            }
            else
            {
                Toast.MakeText(ApplicationContext, "Hardware does not support OpenGL ES 3.0 - Aborting...", ToastLength.Long);
                Log.Info("@string/app_name", "Hardware does not support OpenGL ES 3.0 - Aborting...");
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)

        {
            base.OnCreate(savedInstanceState);
            RequestWindowFeature(WindowFeatures.ActionBar);
            dialog = ConnectionDialog.NewInstance();
            SetContentView(Resource.Layout.main_activity_layout);
            canvas_view = FindViewById <RelativeLayout>(Tutorial.Android.Resource.Id.canvas_container);


            //menu and toolbar

            V7Toolbar toolbar = FindViewById <V7Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            SupportActionBar.SetDisplayShowTitleEnabled(false);
            SupportActionBar.SetTitle(Resource.String.actionbar_title);
            SupportActionBar.SetHomeButtonEnabled(false);
            toolbar.SetNavigationIcon(Resource.Drawable.icon);
            toolbar.InflateMenu(Resource.Menu.menu_main);


            //FrameRateLogger frl = new FrameRateLogger();
            if (SupportedOpenGLVersion() >= 3)
            {
                // SetContentView(new LibPaintingView(ApplicationContext, null));
                // Inject Fusee.Engine.Base InjectMe dependencies

                IO.IOImp = new IOImp(ApplicationContext);

                var fap = new Fusee.Base.Imp.Android.ApkAssetProvider(ApplicationContext);

                fap.RegisterTypeHandler(

                    new AssetHandler

                {
                    ReturnedType = typeof(Font),

                    Decoder = delegate(string id, object storage)

                    {
                        if (Path.GetExtension(id).ToLower().Contains("ttf"))
                        {
                            return new Font

                            {
                                _fontImp = new FontImp((Stream)storage)
                            }
                        }
                        ;

                        return(null);
                    },

                    Checker = delegate(string id)
                    {
                        return(Path.GetExtension(id).ToLower().Contains("ttf"));
                    }
                });