Exemplo n.º 1
0
        protected override void OnContextLost(EventArgs e)
        {
            base.OnContextLost(e);

            // Reinitialize core
            DualityApp.Terminate();
            DualityApp.Init(DualityApp.ExecutionContext.Game, null, null);

            ContentResolver.Current.Init();

            viewportWidth  = Width;
            viewportHeight = Height;

            DualityApp.WindowSize = new Point2(viewportWidth, viewportHeight);
            INativeWindow window = DualityApp.OpenWindow(new WindowOptions());

            ContentResolver.Current.InitPostWindow();

            // Reinitialize input
            TouchButtons = null;

            InitializeInput();

            // Reinitialize the game
            current = new App(window);
            current.ShowMainMenu(false);
        }
Exemplo n.º 2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            viewportWidth  = Width;
            viewportHeight = Height;

            // ToDo: Create Android-specific AssemblyLoader
            DualityApp.Init(DualityApp.ExecutionContext.Game, /*new DefaultAssemblyLoader()*/ null, null);

            DualityApp.WindowSize = new Point2(viewportWidth, viewportHeight);
            INativeWindow window = DualityApp.OpenWindow(new WindowOptions {
                ScreenMode = ScreenMode.Window
            });

            FocusableInTouchMode = true;
            RequestFocus();

            InitializeInput();

            controller = new Controller(window);
            controller.ShowMainMenu();

            // Run the render loop
            Run();
        }
Exemplo n.º 3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // Initialize core
            // ToDo: Create Android-specific AssemblyLoader
            DualityApp.Init(DualityApp.ExecutionContext.Game, null, null);

            // Check if graphics backend is supported
            if (DualityApp.GraphicsBackend is DummyGraphicsBackend)
            {
                MainActivity mainActivity = Context as MainActivity;
                if (mainActivity != null)
                {
                    mainActivity.ShowInfoScreen("This device is not powerful enough", "OpenGL ES 3.0 support is required to run this application.", false);
                }
                return;
            }

            i18n.Language = Preferences.Get <string>("Language", "en");

            ContentResolver.Current.Init();

            viewportWidth  = Width;
            viewportHeight = Height;

            DualityApp.WindowSize = new Point2(viewportWidth, viewportHeight);
            INativeWindow window = DualityApp.OpenWindow(new WindowOptions {
                ScreenMode = ScreenMode.Immersive
            });

            ContentResolver.Current.InitPostWindow();

            // Initialize input
            FocusableInTouchMode = true;
            RequestFocus();

            InitializeInput();

            // Initialize the game
            current = new App(window);

            current.PlayCinematics("intro", endOfStream => {
                current.ShowMainMenu(endOfStream);
            });

            // Run the render loop
            Run(60);
        }